<template>
    <div class="cont-detail" v-loading="loading">
        <div id="detail">
            <el-form :rules="rules" :label-position="labePosition" label-width="110px" size="mini" class="form">
                <el-row class="row-style">
                    <el-card>
                        <el-row>
                            <el-col :span="24">
                                <el-form-item label="风险说明">
                                    <el-input name="风险说明" v-model="entryControl.entryName" :disabled="showDisdata" />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="风险类型">
                                    <el-select
                                        placeholder="请选择"
                                        name="entryType"
                                        style="width: 100%"
                                        :disabled="showDisdata"
                                        @change="handleChang('entryType', entryControl.entryType)"
                                        v-model="entryControl.entryType"
                                    >
                                        <el-option
                                            v-for="item in entryType"
                                            :key="item.dictKey"
                                            :name="'entryType-' + item.dictKey"
                                            :label="item.dictKey + ' ' + item.dictKeyName"
                                            :value="item.dictKey"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="3">
                                <el-form-item label="启用状态">
                                    <el-switch v-model="entryControl.entryStatusValid" name="启用状态" :disabled="showDisdata" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="3">
                                <el-form-item label="前提条目">
                                    <el-switch
                                        v-model="entryControl.premise"
                                        :disabled="
                                            showDisdata ||
                                                !['0', '1'].includes(entryControl.originalAccountId) ||
                                                ['10'].includes(entryControl.entryType)
                                        "
                                        @change="changPremise(entryControl.premise)"
                                    />
                                </el-form-item>
                            </el-col>
                            <el-col :span="4">
                                <el-form-item label="作用范围">
                                    <el-checkbox-group
                                        v-model="entryControl.riskCalTypes"
                                        @change="handleRiskCalTypes"
                                        :disabled="showDisdata"
                                        style="width: 135%"
                                    >
                                        <el-checkbox label="1">指令 </el-checkbox>
                                        <el-checkbox label="0" style="margin-left: -10%">静态</el-checkbox>
                                    </el-checkbox-group>
                                </el-form-item>
                            </el-col>
                            <el-col :span="4" v-if="entryControl.entryType == '11'">
                                <el-form-item label="提醒内容">
                                    <el-input v-model="entryParamsl.paramValue" />
                                </el-form-item>
                            </el-col>
                            <el-col :span="4">
                                <el-form-item label="优先级" :label-width="'110px'">
                                    <el-input-number
                                        controls-position="right"
                                        name="level"
                                        v-model="entryControl.level"
                                        :min="1"
                                        :max="10"
                                        :disabled="showDisdata"
                                    />
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="6">
                                <el-form-item label="生效日期">
                                    <el-date-picker
                                        type="date"
                                        format="yyyy-MM-dd"
                                        value-format="yyyyMMdd"
                                        placeholder="选择日期"
                                        v-model="entryControl.beginDate"
                                        style="width: 100%"
                                        :disabled="visible || showDisdata"
                                    />
                                </el-form-item>
                            </el-col>
                            <el-col :span="6">
                                <el-form-item label="失效日期">
                                    <el-date-picker
                                        type="date"
                                        placeholder="选择日期"
                                        format="yyyy-MM-dd"
                                        value-format="yyyyMMdd"
                                        v-model="entryControl.endDate"
                                        style="width: 63%"
                                        :disabled="visible || showDisdata"
                                    />
                                    <el-popover placement="bottom" width="260" v-model="visible">
                                        <div style="text-align: right; margin: 0; padding: 5px">
                                            <div class="detail-col">
                                                <el-row style="margin: 0 0 0 2px">
                                                    <el-col :span="6"> 周期类型 </el-col>
                                                    <el-col :span="17">
                                                        <el-select
                                                            v-model="entryControl.controlValue"
                                                            clearable
                                                            @change="handleBaseInfo(entryControl.controlValue)"
                                                        >
                                                            <el-option
                                                                :disabled="showDisdata"
                                                                v-for="itme in types"
                                                                :key="itme.dictKey"
                                                                :label="itme.dictKeyName"
                                                                :value="itme.dictKey"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-col>
                                                </el-row>
                                                <el-row style="margin: 0 0 0 2px">
                                                    <el-col :span="6"> 控制值 </el-col>
                                                    <el-col :span="17">
                                                        <el-select
                                                            v-model="entryControl.dateType"
                                                            @change="changeDate(entryControl.dateType)"
                                                            clearable
                                                        >
                                                            <el-option
                                                                v-for="itme in typeDetails"
                                                                :disabled="showDisdata"
                                                                :key="itme.dictKey"
                                                                :label="itme.dictKeyName"
                                                                :value="itme.dictKey"
                                                            ></el-option>
                                                        </el-select>
                                                    </el-col>
                                                </el-row>
                                                <el-row style="margin: 0 0 0 2px">
                                                    <el-col :span="6"> 是否循环 </el-col>
                                                    <el-col :span="2">
                                                        <el-switch
                                                            v-model="entryControl.isCycle"
                                                            active-value="1"
                                                            inactive-value="0"
                                                            :disabled="showDisdata"
                                                        >
                                                        </el-switch>
                                                    </el-col>
                                                </el-row>
                                            </div>
                                            <el-button type="primary" size="mini" @click="visible = false">确定</el-button>
                                        </div>
                                        <el-button size="mini" slot="reference" type="primary" style="margin-left: 4px">更多</el-button>
                                    </el-popover>
                                </el-form-item>
                            </el-col>
                            <el-col :span="colList.col1">
                                <el-form-item label="条目标签">
                                    <el-select
                                        placeholder="请选择"
                                        style="width: 100%"
                                        multiple
                                        filterable
                                        v-model="entryControl.entryTagIds"
                                        :title="entryControl.entryTagIds"
                                    >
                                        <el-option
                                            v-for="(itme, index) in entryTagIdList"
                                            :key="itme.dictKey + index"
                                            :label="itme.dictKey + ' ' + itme.dictKeyName"
                                            :value="itme.dictKey"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="colList.col2">
                                <el-form-item label="风险等级">
                                    <el-select placeholder="请选择" v-model="entryControl.controlGrade" :disabled="showDisdata" style="width: 100%">
                                        <el-option
                                            v-for="itme in controlGrade"
                                            :key="itme.dictKey"
                                            :label="itme.dictKey + ' ' + itme.dictKeyName"
                                            :value="itme.dictKey"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="colList.col3">
                                <el-form-item label="比较方向">
                                    <el-select
                                        placeholder="请选择"
                                        name="compareType"
                                        v-model="entryControl.compareType"
                                        style="width: 100%"
                                        :disabled="
                                            entryControl.entryType === '3' ||
                                                entryControl.entryType === '5' ||
                                                entryControl.entryType === '11' ||
                                                showDisdata
                                        "
                                    >
                                        <el-option
                                            v-for="itme in compareDirection"
                                            :key="itme.dictKey"
                                            :label="itme.dictKey + ' ' + itme.dictKeyName"
                                            :value="itme.dictKey"
                                        ></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-card>
                </el-row>
                <el-row class="row-style card-box">
                    <el-col :span="12">
                        <el-card class="card-left" :style="{ height: entryControl.sourceType === '2' ? '145px' : '' }">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="账户层次">
                                        <el-select
                                            placeholder="请选择"
                                            name="账户层次"
                                            v-model="entryControl.originalAccountId"
                                            style="width: 100%"
                                            :disabled="showDisdata"
                                            @change="changOriginalAccoutId()"
                                        >
                                            <el-option
                                                v-for="item in originalAccountType"
                                                :key="item.dictKey"
                                                :label="item.dictKey + ' ' + item.dictKeyName"
                                                :value="item.dictKey"
                                                :name="'originalAccountType' + item.dictKey"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="控制类型">
                                        <el-select
                                            placeholder="请选择"
                                            name="accountControlType"
                                            :disabled="showDisdata"
                                            v-model="entryControl.accountControlType"
                                            style="width: 100%"
                                        >
                                            <!-- <el-option
                                                    v-for="itme in accountControlType_0"
                                                    :key="itme.dictKey"
                                                    :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                    :value="itme.dictKey"
                                                ></el-option> -->
                                            <el-option
                                                v-show="entryControl.entryType != 11"
                                                v-for="(value, key) in accountControlTypeSelect[entryControl.originalAccountId]"
                                                :name="'accountControlType-' + key"
                                                :key="key"
                                                :label="key + ' ' + value"
                                                :value="key"
                                            ></el-option>
                                            <!-- 当风险类型=3 账户层次=1 时展示 -->
                                            <el-option
                                                v-show="entryControl.entryType == 3 && entryControl.originalAccountId == 1"
                                                v-for="(value, key) in entryType3AccountControlTypes"
                                                :name="'accountControlType-' + key"
                                                :key="key"
                                                :label="key + ' ' + value"
                                                :value="key"
                                            ></el-option>
                                            <!-- 当风险类型=3 账户层次=0 时展示 -->
                                            <el-option
                                                v-show="entryControl.entryType == 3 && entryControl.originalAccountId == 0"
                                                v-for="(value, key) in entryType3AccountControlTypes1"
                                                :name="'accountControlType-' + key"
                                                :key="key"
                                                :label="key + ' ' + value"
                                                :value="key"
                                            ></el-option>
                                            <!-- 当风险类型=0 账户层次=3 时展示 -->
                                            <el-option
                                                v-show="entryControl.entryType == 0 && entryControl.originalAccountId == 3"
                                                name="accountControlType-11"
                                                label="11 资产单元组内按基金联合控制"
                                                value="11"
                                            ></el-option>
                                            <!-- 当风险类型=11 账户层次=3 时展示 -->
                                            <el-option
                                                v-show="entryControl.entryType == 11"
                                                name="accountControlType-12"
                                                label="0 单产品控制"
                                                value="0"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item :label="getAccountControlValueLabel()" v-if="['2', '4'].includes(entryControl.originalAccountId)">
                                        <RiskEntryInputs
                                            :showAll="true"
                                            @set-entry-data="getAccountControlValue"
                                            :interfaceUrl="getAccountControlValueAPI()"
                                            :returnDatas="entryControl.accountControlValue"
                                            :showDis="showDisdata"
                                            :dictKey="dictKey"
                                            :dictKeyName="dictKeyName"
                                        />
                                    </el-form-item>
                                    <el-form-item label="控制账户" v-else-if="entryControl.originalAccountId == '0'">
                                        <el-tooltip effect="dark" placement="top-start" :disabled="!tooltipFunds.length">
                                            <ul slot="content" style="min-height: 18px; max-height: 200px; overflow: auto">
                                                <li :key="item.value" v-for="item in tooltipFunds">
                                                    {{ item['label'] }}
                                                </li>
                                            </ul>
                                            <!-- <el-select
                                                placeholder="请选择"
                                                name="控制账户"
                                                v-model="entryControl.accountControlValue"
                                                multiple
                                                filterable
                                                collapse-tags
                                                style="width: 100%"
                                                @change="changeAccountControlValue(entryControl.accountControlValue)"
                                            >
                                                <el-option
                                                    label="选择全部"
                                                    value="-1"
                                                    name="accountControlValue-1"
                                                    :disabled="Accountdisabled || showDisdata"
                                                ></el-option>
                                                <el-option
                                                    :disabled="AccountdisabledAll || showDisdata"
                                                    v-for="i in fundInfo"
                                                    :key="i.value"
                                                    :label="i.label"
                                                    :value="i.value"
                                                ></el-option>
                                            </el-select> -->
                                            <RiskVirtualSelect
                                                v-model="entryControl.accountControlValue"
                                                :selectData="fundInfoSelect"
                                                multiple
                                                filterable
                                                collapse-tags
                                                style="width: 100%"
                                                show1
                                                :showDisdata="showDisdata"
                                                :Accountdisabled="Accountdisabled"
                                                :AccountdisabledAll="AccountdisabledAll"
                                                @change="changeAccountControlValue(entryControl.accountControlValue)"
                                            ></RiskVirtualSelect>
                                        </el-tooltip>
                                        <!-- <RiskEntryInputs
                                            :showAll="true"
                                            @set-entry-data="getAccountControlValue"
                                            :returnDatas="entryControl.accountControlValue"
                                            :showDis="showDisdata"
                                        /> -->
                                    </el-form-item>
                                    <el-form-item label="账户组" v-else-if="entryControl.originalAccountId == '1'">
                                        <!-- <el-select
                                            placeholder="请选择"
                                            name="账户组"
                                            v-model="entryControl.accountControlValue"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in fundGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            >
                                            </el-option>
                                        </el-select> -->

                                        <Treeselect
                                            name="accountGroup"
                                            id="accountGroup"
                                            v-model="entryControl.accountControlValue"
                                            :multiple="true"
                                            placeholder="请选择"
                                            :options="fundGroupTreeData1"
                                            :default-expand-level="1"
                                            :value-consists-of="'LEAF_PRIORITY'"
                                            :append-to-body="true"
                                            :max-height="200"
                                            :limit="1"
                                            :limitText="limitText"
                                            @select="handleAccountGroupTreeSelect"
                                            @deselect="handleAccountGroupTreeDeSelect"
                                            @open="handleAccountGroupTreeOpen"
                                            noOptionsText="暂无数据"
                                            noResultsText="无匹配数据"
                                        >
                                            <!-- #39016 【华泰资产】【业务反馈】【生产-风险设置】编辑-未点击“x”的部分不应删除内容 -->
                                            <span slot="value-label" slot-scope="{ node }" @mousedown.stop>
                                                {{ node.label }}
                                            </span>
                                        </Treeselect>
                                    </el-form-item>
                                    <!-- 单个 -->

                                    <el-form-item label="资产单元组" v-else-if="entryControl.originalAccountId == '3'">
                                        <!-- <el-select
                                            placeholder="请选择"
                                            v-model="entryControl.accountControlValue"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in assetGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            >
                                            </el-option>
                                        </el-select> -->
                                        <RiskVirtualSelect
                                            v-model="entryControl.accountControlValue"
                                            :selectData="assetGroupSelect"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                        </RiskVirtualSelect>
                                    </el-form-item>
                                    <el-form-item label="投资组合组" v-else-if="entryControl.originalAccountId == '5'">
                                        <!-- <el-select
                                            placeholder="请选择"
                                            v-model="entryControl.accountControlValue"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in fdAcGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            >
                                            </el-option>
                                        </el-select> -->
                                        <RiskVirtualSelect
                                            v-model="entryControl.accountControlValue"
                                            :selectData="fdAcGroupSelect"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                        </RiskVirtualSelect>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="排除账户" v-if="['0', '1'].includes(entryControl.originalAccountId)">
                                        <el-tooltip effect="dark" placement="top-start" :disabled="!tooltipFunds2.length">
                                            <ul slot="content" style="min-height: 18px; max-height: 200px; overflow: auto">
                                                <li :key="item.value" v-for="item in tooltipFunds2">
                                                    {{ item['label'] }}
                                                </li>
                                            </ul>
                                            <!-- <el-select
                                                placeholder="请选择"
                                                v-model="entryControl.accountDebarValue"
                                                multiple
                                                filterable
                                                collapse-tags
                                                style="width: 100%"
                                                @change="changeAccountControlValue2(entryControl.accountDebarValue)"
                                            >
                                                <el-option label="选择全部" value="-1" :disabled="Accountdisabled2 || showDisdata"></el-option>
                                                <el-option
                                                    :disabled="AccountdisabledAll2 || showDisdata"
                                                    v-for="i in fundInfo2"
                                                    :key="i.value"
                                                    :label="i.label"
                                                    :value="i.value"
                                                ></el-option>
                                            </el-select> -->
                                            <RiskVirtualSelect
                                                v-model="entryControl.accountDebarValue"
                                                :selectData="fundInfoSelect2"
                                                multiple
                                                filterable
                                                collapse-tags
                                                style="width: 100%"
                                                show1
                                                :showDisdata="showDisdata"
                                                :Accountdisabled="Accountdisabled2"
                                                :AccountdisabledAll="AccountdisabledAll2"
                                                @change="changeAccountControlValue2(entryControl.accountDebarValue)"
                                            ></RiskVirtualSelect>
                                        </el-tooltip>
                                        <!-- <RiskEntryInputs
                                            :showAll="false"
                                            @set-entry-data="getAccountDebarValue"
                                            :returnDatas="entryControl.accountDebarValue"
                                            :showDis="showDisdata"
                                        /> -->
                                    </el-form-item>
                                    <el-form-item :label="getAccountIdLabel()" v-else>
                                        <RiskEntryInputs
                                            :showAll="false"
                                            :interfaceUrl="getAccountControlValueAPI()"
                                            @set-entry-data="getSingleAccountDebarValue"
                                            :returnDatas="getReturnDatas()"
                                            :showDis="showDisdata"
                                            :dictKey="dictKey"
                                            :dictKeyName="dictKeyName"
                                            :key="deBarKey + 'deBarKey'"
                                        ></RiskEntryInputs>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="排除账户组" v-if="['0', '1'].includes(entryControl.originalAccountId)">
                                        <el-select
                                            v-if="entryControl.originalAccountId !== '1'"
                                            placeholder="请选择"
                                            multiple
                                            filterable
                                            collapse-tags
                                            v-model="entryControl.accountGroupDebarValue"
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in fundGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            ></el-option>
                                        </el-select>
                                        <Treeselect
                                            v-else
                                            placeholder="请选择"
                                            v-model="entryControl.accountGroupDebarValue"
                                            :multiple="true"
                                            :options="fundGroupTreeData2"
                                            :default-expand-level="1"
                                            :append-to-body="true"
                                            :limit="1"
                                            :limitText="limitText"
                                            :max-height="200"
                                            :value-consists-of="'LEAF_PRIORITY'"
                                            @select="handleAccountGroupDebarTreeSelect"
                                            @deselect="handleAccountGroupDebarTreeDeSelect"
                                            @open="handleAccountGroupDebarTreeOpen"
                                            noOptionsText="暂无数据"
                                            noResultsText="无匹配数据"
                                        >
                                            <!-- #39016 【华泰资产】【业务反馈】【生产-风险设置】编辑-未点击“x”的部分不应删除内容 -->
                                            <span slot="value-label" slot-scope="{ node }" @mousedown.stop>
                                                {{ node.label }}
                                            </span>
                                        </Treeselect>
                                    </el-form-item>

                                    <el-form-item label="排除资产单元组" v-if="['2', '3'].includes(entryControl.originalAccountId)">
                                        <!-- <el-select
                                            placeholder="请选择"
                                            v-model="entryControl.assetGroupDebarValue"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in assetGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            >
                                            </el-option>
                                        </el-select> -->
                                        <RiskVirtualSelect
                                            v-model="entryControl.assetGroupDebarValue"
                                            :selectData="assetGroupSelect"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                        </RiskVirtualSelect>
                                    </el-form-item>
                                    <el-form-item label="排除投资组合组" v-if="['4', '5'].includes(entryControl.originalAccountId)">
                                        <!-- <el-select
                                            placeholder="请选择"
                                            v-model="entryControl.fdAcGroupDebarValue"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                            <el-option
                                                v-for="itme in fdAcGroup"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                                :disabled="showDisdata"
                                            >
                                            </el-option>
                                        </el-select> -->
                                        <RiskVirtualSelect
                                            v-model="entryControl.fdAcGroupDebarValue"
                                            :selectData="fdAcGroupSelect"
                                            multiple
                                            filterable
                                            collapse-tags
                                            style="width: 100%"
                                        >
                                        </RiskVirtualSelect>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </el-col>
                    <el-col :span="12">
                        <el-card class="card-right">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="控制值1">
                                        <RiskInputNumber
                                            :input="entryControl.thresholdValue1"
                                            :field="'thresholdValue1'"
                                            :precision="4"
                                            :allowMinus="true"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.entryType === '11' ||
                                                    showDisdata
                                            "
                                            @getInputNumber="getInputNumber(arguments)"
                                            class="right-inputs"
                                        >
                                        </RiskInputNumber>
                                        <!-- <el-input-number
                                            controls-position="right"
                                            :disabled="entryControl.entryType === '3' || entryControl.entryType === '5' || showDisdata"
                                            v-model.trim="entryControl.thresholdValue1"
                                            class="right-inputs"
                                        /> -->
                                        <el-select
                                            class="select-style"
                                            clearable
                                            v-model="entryControl.unit"
                                            :disabled="showDisdata"
                                            placeholder="无"
                                        >
                                            <el-option
                                                v-for="item in unitFilter[this.entryControl.entryType]"
                                                :disabled="showDisdata"
                                                :key="item"
                                                :label="item"
                                                :value="item"
                                            >
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="触警操作1">
                                        <el-select
                                            v-model="entryControl.thresholdType1"
                                            :disabled="showDisdata"
                                            style="widht: 100%"
                                            clearable
                                            @change="changeThresholdType('1')"
                                        >
                                            <el-option
                                                v-for="itme in thresholdType"
                                                :disabled="showDisdata"
                                                :key="itme.dictKey"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="控制值2">
                                        <RiskInputNumber
                                            :input="entryControl.thresholdValue2"
                                            :field="'thresholdValue2'"
                                            :precision="4"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.entryType === '11' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            :allowMinus="true"
                                            @getInputNumber="getInputNumber(arguments)"
                                            class="right-inputs"
                                        >
                                        </RiskInputNumber>
                                        <!-- <el-input-number
                                            controls-position="right"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            v-model="entryControl.thresholdValue2"
                                            class="right-inputs"
                                        /> -->
                                        <el-select
                                            class="select-style"
                                            clearable
                                            v-model="entryControl.unit"
                                            :disabled="entryControl.premise === true || showDisdata"
                                            placeholder="无"
                                        >
                                            <el-option
                                                v-for="item in unitFilter[this.entryControl.entryType] || ['无']"
                                                :key="item"
                                                :label="item"
                                                :value="item"
                                            >
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="触警操作2">
                                        <el-select
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.entryType === '11' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            v-model="entryControl.thresholdType2"
                                            style="widht: 100%"
                                            @change="changeThresholdType2('2')"
                                            clearable
                                        >
                                            <el-option
                                                v-for="itme in thresholdType"
                                                :key="itme.dictKey"
                                                :disabled="itme.dictKey < entryControl.thresholdType1"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="控制值3">
                                        <RiskInputNumber
                                            :input="entryControl.thresholdValue3"
                                            :field="'thresholdValue3'"
                                            :precision="4"
                                            :allowMinus="true"
                                            :disabled="entryControl.premise === true || showDisdata"
                                            @getInputNumber="getInputNumber(arguments)"
                                            class="right-inputs"
                                        >
                                        </RiskInputNumber>
                                        <!-- <el-input-number
                                            controls-position="right"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            v-model="entryControl.thresholdValue3"
                                            class="right-inputs"
                                        /> -->
                                        <el-select
                                            class="select-style"
                                            clearable
                                            v-model="entryControl.unit"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.entryType === '11' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            placeholder="无"
                                        >
                                            <el-option
                                                v-for="item in unitFilter[this.entryControl.entryType]"
                                                :disabled="showDisdata"
                                                :key="item"
                                                :label="item"
                                                :value="item"
                                            >
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="触警操作3">
                                        <el-select
                                            clearable
                                            v-model="entryControl.thresholdType3"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.entryType === '11' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                            style="widht: 100%"
                                        >
                                            <el-option
                                                v-for="itme in thresholdType"
                                                :key="itme.dictKey"
                                                :disabled="itme.dictKey < entryControl.thresholdType2 || itme.dictKey < entryControl.thresholdType1"
                                                :label="itme.dictKey + ' ' + itme.dictKeyName"
                                                :value="itme.dictKey"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row v-if="entryControl.sourceType === '2'">
                                <el-col :span="12">
                                    <el-form-item label="静态控制值">
                                        <RiskInputNumber
                                            :input="entryControl.saThresholdValue"
                                            :field="'saThresholdValue'"
                                            :precision="4"
                                            :disabled="
                                                entryControl.entryType === '3' || entryControl.entryType === '5' || entryControl.premise === true
                                            "
                                            @getInputNumber="getInputNumber(arguments)"
                                            class="right-inputs"
                                        >
                                        </RiskInputNumber>

                                        <el-select
                                            class="select-style"
                                            clearable
                                            v-model="entryControl.unit"
                                            :disabled="
                                                entryControl.entryType === '3' || entryControl.entryType === '5' || entryControl.premise === true
                                            "
                                            placeholder="无"
                                            size="mini"
                                        >
                                            <el-option
                                                v-for="item in unitFilter[this.entryControl.entryType]"
                                                :disabled="showDisdata"
                                                :key="item"
                                                :label="item"
                                                :value="item"
                                            >
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="静态触警操作" label-width="110px">
                                        <el-select
                                            clearable
                                            v-model="entryControl.saThresholdType"
                                            size="mini"
                                            :disabled="
                                                entryControl.entryType === '3' ||
                                                    entryControl.entryType === '5' ||
                                                    entryControl.premise === true ||
                                                    showDisdata
                                            "
                                        >
                                            <el-option
                                                v-for="i in thresholdType"
                                                :key="i.dictKey"
                                                :disabled="i.dictKey < entryControl.thresholdType2 || i.dictKey < entryControl.thresholdType1"
                                                :label="i.dictKey + ' ' + i.dictKeyName"
                                                :value="i.dictKey"
                                            ></el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </el-col>
                </el-row>
                <el-row class="row-style content-3">
                    <el-card>
                        <el-tabs type="card" v-model="activeTab">
                            <el-tab-pane label="分支设置" name="branch">
                                <!-- <BranchSetting
                                    @set-branch-data="getBranchData"
                                    :riskEntryBranchList="riskEntryBranchList"
                                    :showData="showDisdata"
                                    :entryControls="entryControl"
                                    :style="{height: entryControl.sourceType === '2'?'calc(45vh - 30px)':'45vh'}"
                                ></BranchSetting> -->
                                <RiskBranchSetting
                                    @set-branch-data="getBranchData"
                                    :showData="showDisdata"
                                    :entryControls="entryControl"
                                    :entryType="entryControl.entryType"
                                    :riskEntryBranchList="riskEntryBranchs"
                                ></RiskBranchSetting>
                            </el-tab-pane>
                            <el-tab-pane label="高级设置" name="high">
                                <HighSetting
                                    style="height: 258px"
                                    @set-high-data="getHighdata"
                                    :entryParamsList="entryParamsList"
                                    :fxType="entryControl.entryType"
                                    :riskCalTypes="entryControl.riskCalTypes"
                                    :accountControlType="entryControl.accountControlType"
                                    :showData="showDisdata"
                                ></HighSetting>
                            </el-tab-pane>

                            <el-tab-pane label="基金范围" name="fundScope" :disabled="!['0', '1'].includes(entryControl.originalAccountId)">
                                <el-col :span="12">
                                    <BoundCfgSetting
                                        :stockBound="fundRangesList"
                                        investGroupType="0"
                                        operateType="edit"
                                        operatePanelHeight="210px"
                                        style="height: 258px"
                                        :showData="showDisdata"
                                        @onHandleOperateOver="onHandleOperateOver"
                                    ></BoundCfgSetting>
                                </el-col>
                            </el-tab-pane>
                            <el-tab-pane
                                label="联合设置"
                                name="unite"
                                :disabled="
                                    entryControl.premise === true ||
                                        !['0', '1'].includes(entryControl.originalAccountId) ||
                                        ['3', '10'].includes(entryControl.entryType)
                                "
                            >
                                <UniteSetting
                                    style="height: 258px"
                                    @set-unite-data="getUniteData"
                                    :joinRiskEntryControls="riskEntryControlRelation.joinRiskEntryControls"
                                    :showData="showDisdata || !['0', '1'].includes(entryControl.originalAccountId)"
                                    :entryControls="entryControl"
                                ></UniteSetting>
                            </el-tab-pane>
                            <el-tab-pane
                                label="前提条件"
                                name="premise"
                                :disabled="
                                    entryControl.premise === true ||
                                        !['0', '1'].includes(entryControl.originalAccountId) ||
                                        ['3', '10'].includes(entryControl.entryType)
                                "
                            >
                                <ItemPremise
                                    style="height: 258px"
                                    @set-premise-data="getPremiseData"
                                    :premiseRiskEntryControls="riskEntryControlRelation.premiseRiskEntryControls"
                                    :premiseRelations="premiseRelations"
                                    :showData="showDisdata"
                                >
                                </ItemPremise>
                            </el-tab-pane>
                            <el-tab-pane
                                label="互斥设置"
                                name="mutex"
                                :disabled="
                                    entryControl.premise === true ||
                                        !['0', '1'].includes(entryControl.originalAccountId) ||
                                        ['3', '10'].includes(entryControl.entryType)
                                "
                            >
                                <MutexSetting
                                    style="height: 258px"
                                    @set-mutex-data="getMutexData"
                                    :showData="showDisdata"
                                    :mutualRiskEntryControls="riskEntryControlRelation.mutualRiskEntryControls"
                                    :entryControls="entryControl"
                                ></MutexSetting>
                            </el-tab-pane>
                            <el-tab-pane
                                label="可投余量"
                                name="useMargin"
                                :showData="showDisdata"
                                :disabled="
                                    ['3', '5', '10', '11'].includes(entryControl.entryType) || !['0', '1'].includes(entryControl.originalAccountId)
                                "
                            >
                                <UseMargin
                                    :branchData="branchData"
                                    @set-use-data="getUserData"
                                    :entryControl="entryControl"
                                    :riskEntryBranchs="riskEntryBranchs"
                                    :showData="showDisdata"
                                    style="height: 258px"
                                ></UseMargin>
                            </el-tab-pane>
                            <el-tab-pane label="备注" name="remark">
                                <Remark :showData="showDisdata" :entryControl="entryControl" style="height: 100%" @content-change="submitContent" />
                            </el-tab-pane>
                        </el-tabs>
                    </el-card>
                </el-row>
                <el-row class="row-style">
                    <el-card>
                        <div class="buts">
                            <el-button
                                v-authCode.show="B_0025"
                                type="danger"
                                v-if="itemData.type == 'lookCheck'"
                                :disabled="userInfo.superuser == true ? false : userInfo.userCode == itemData.content.modifyUserCode ? true : false"
                                @click="submitVerification2('1')"
                                >复核拒绝</el-button
                            >
                            <el-button
                                v-authCode.show="B_0024"
                                type="primary"
                                v-if="itemData.type == 'lookCheck'"
                                :disabled="userInfo.superuser == true ? false : userInfo.userCode == itemData.content.modifyUserCode ? true : false"
                                @click="submitVerification2('2')"
                                >复核通过</el-button
                            >
                            <el-button @click="cancelTable">取消</el-button>
                            <!-- <el-button
                                type="primary"
                                @click="submitData"
                                :disabled="sbmitdisabled"
                                v-if="itemData.type == 'add' || itemData.type == 'edit' || itemData.type == 'copy' || itemData.type == 'editCheck'"
                                >确认</el-button
                            > -->
                            <el-button
                                type="primary"
                                name="确认"
                                @click="submitVerification"
                                :disabled="sbmitdisabled"
                                v-if="
                                    itemData.type == 'add' ||
                                        itemData.type == 'edit' ||
                                        itemData.type == 'copy' ||
                                        itemData.type == 'editCheck' ||
                                        itemData.type == 'editCheckSetting'
                                "
                                >确认</el-button
                            >
                        </div>
                    </el-card>
                </el-row>
            </el-form>
        </div>
        <el-dialog :title="verificationTitle" :visible.sync="verification" width="600px" v-loading="loading" drag>
            <div class="edit-div">
                <div>
                    <div style="font-size: 15px; margin-bottom: 2px">【条目编号】</div>
                    <div style="color: green; margin-left: 20px">{{ selectedArrList[0] ? selectedArrList[0].entryCode : '' }}</div>
                </div>
                <EntryItemCompare
                    v-if="editDatas.EntryControl && editDatas.EntryControl.length > 0"
                    title="条目基本信息"
                    :data="editDatas.EntryControl"
                />
                <EntryItemCompare
                    v-if="editDatas.EntryBranch && editDatas.EntryBranch.length > 0"
                    title="条目分支信息"
                    :data="editDatas.EntryBranch"
                />
                <EntryItemCompare
                    v-if="editDatas.EntryBranchConfig && editDatas.EntryBranchConfig.length > 0"
                    title="条目分支范围配置信息"
                    :data="editDatas.EntryBranchConfig"
                />
                <EntryItemCompare
                    v-if="editDatas.RiskEntryParam && editDatas.RiskEntryParam.length > 0"
                    title="高级设置信息"
                    :data="editDatas.RiskEntryParam"
                />
                <EntryItemCompare
                    v-if="editDatas.EntryFundConfig && editDatas.EntryFundConfig.length > 0"
                    title="基金范围信息"
                    :data="editDatas.EntryFundConfig"
                />
                <EntryItemCompare
                    v-if="editDatas.RiskCustomResidualMaturity && editDatas.RiskCustomResidualMaturity.length > 0"
                    title="条目自定义设置-剩余期限参数"
                    :data="editDatas.RiskCustomResidualMaturity"
                />
                <EntryItemCompare
                    v-if="editDatas.RiskCustomApprovalTier && editDatas.RiskCustomApprovalTier.length > 0"
                    title="条目自定义设置-审批层级参数设置"
                    :data="editDatas.RiskCustomApprovalTier"
                />
                <EntryItemCompare
                    v-if="editDatas.RegulationsPublicOffering && editDatas.RegulationsPublicOffering.length > 0"
                    title="条目自定义设置-法规公募"
                    :data="editDatas.RegulationsPublicOffering"
                />
                <EntryItemCompare
                    v-if="editDatas.RegulationsOnlyDoorGather && editDatas.RegulationsOnlyDoorGather.length > 0"
                    title="条目自定义设置-法规专户(集合)"
                    :data="editDatas.RegulationsOnlyDoorGather"
                />
                <EntryItemCompare
                    v-if="editDatas.RegulationsOnlyDoorSingle && editDatas.RegulationsOnlyDoorSingle.length > 0"
                    title="条目自定义设置-法规专户(单一)"
                    :data="editDatas.RegulationsOnlyDoorSingle"
                />
                <EntryItemCompare
                    v-if="editDatas.JoinRiskEntryControls && editDatas.JoinRiskEntryControls.length > 0"
                    title="条目关联"
                    :data="editDatas.JoinRiskEntryControls"
                />
                <EntryItemCompare
                    v-if="editDatas.MutualRiskEntryControls && editDatas.MutualRiskEntryControls.length > 0"
                    title="条目互斥"
                    :data="editDatas.MutualRiskEntryControls"
                />
                <EntryItemCompare
                    v-if="editDatas.PremiseRiskEntryControls && editDatas.PremiseRiskEntryControls.length > 0"
                    title="前提条目"
                    :data="editDatas.PremiseRiskEntryControls"
                />
                <EntryItemCompareHT001
                    v-if="editDatas.EntryBranch_HT001 && editDatas.EntryBranch_HT001.length > 0"
                    title="条目分支信息"
                    :data="editDatas.EntryBranch_HT001"
                />
                <!-- <EntryItemCompare
                    v-if="editDatas.ConsecutiveViolationDays && editDatas.ConsecutiveViolationDays.length > 0"
                    title="连续违规天数"
                    :data="editDatas.ConsecutiveViolationDays"
                /> -->
                <hr style="margin: 10px 0" v-if="itemData.type == 'lookCheck' && verifiData.entryControl.modifyType != '1'" />
                <div v-if="itemData.type == 'lookCheck'">
                    <p style="font-size: 15px; padding-bottom: 5px">【备注原因】</p>
                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="请备注原因" v-model="entryControl.checkReason">
                    </el-input>
                </div>
                <div style="margin-top: 15px; margin-left: 5px">
                    <el-checkbox v-model="entryControl.prohibitionReset" true-label="1" false-label="0" :disabled="prohibitionReset"
                        >重置连续违规天数</el-checkbox
                    >
                </div>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button size="mini" @click="verification = false">取 消</el-button>
                <el-button size="mini" :disabled="sbmitdisabled" type="primary" @click="submitVerificationData">确 定 </el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script lang="ts">
import { Component, Prop, Watch } from 'vue-property-decorator';
import DictionConstUtil, { SGU_CACHE } from '@/utils/diction-const-util';
import { mixins } from 'vue-class-component';
import Control from '@/utils/risk-setting';
import BranchSetting from './branch-setting.vue';
import HighSetting from './high-setting.vue';
import FundScope from './fund-scope.vue';
import UniteSetting from './unite-setting.vue';
import MutexSetting from './mutex-setting.vue';
import UseMargin from './use-margin.vue';
import ItemPremise from './item-premise.vue';
import RiskEmitter from '@/common/mixis/risk-emitter.vue';
import BoundCfgSetting from '@/pages/baseparam/fund-group-setting/BoundCfgSetting.vue';
import RiskEntryInputs from '@/common/components/risk-entry-inputs.vue';
import { accMul, accDiv, numberFormat, changeOptions, getConfigItem } from '@/utils/tools';
import RiskInputNumber from '@/pages/risk-measure/components/risk-input-number.vue';
import EntryItemCompare from './item-compare.vue';
import EntryItemCompareHT001 from './item-compare-ht001.vue';
import { IUserInfo, UserModule } from '@/store/modules/user';
import toArrayTree from 'xe-utils/methods/array/toArrayTree';
import RiskBranchSetting from '@/common/components/risk-branch-setting.vue';
import Remark from './remark.vue';
import RemarkInfo from './remark-info.vue';
import RelatedClause from './related-clause.vue';

@Component({
    name: 'ItemControlDetail',
    components: {
        BranchSetting,
        HighSetting,
        BoundCfgSetting,
        FundScope,
        UniteSetting,
        MutexSetting,
        UseMargin,
        ItemPremise,
        RiskEntryInputs,
        RiskInputNumber,
        EntryItemCompare,
        RiskBranchSetting,
        Remark,
        RemarkInfo,
        RelatedClause,
        EntryItemCompareHT001,
    },
})
export default class ItemControlDetail extends mixins(RiskEmitter) {
    @Prop() itemData: any;
    numberFormat = numberFormat;

    types: any[] = [
        { dictKey: 'month', dictKeyName: '月度' },
        { dictKey: 'season', dictKeyName: '季度' },
        { dictKey: 'year', dictKeyName: '年度' },
    ];
    typeDetails: any[] = [];
    lookCheck: boolean = false;
    months: any[] = [
        { dictKey: '1', dictKeyName: '一月' },
        { dictKey: '2', dictKeyName: '二月' },
        { dictKey: '3', dictKeyName: '三月' },
        { dictKey: '4', dictKeyName: '四月' },
        { dictKey: '5', dictKeyName: '五月' },
        { dictKey: '6', dictKeyName: '六月' },
        { dictKey: '7', dictKeyName: '七月' },
        { dictKey: '8', dictKeyName: '八月' },
        { dictKey: '9', dictKeyName: '九月' },
        { dictKey: '10', dictKeyName: '十月' },
        { dictKey: '11', dictKeyName: '十一月' },
        { dictKey: '12', dictKeyName: '十二月' },
    ];
    seasons: any[] = [
        { dictKey: '1', dictKeyName: '第一季度' },
        { dictKey: '2', dictKeyName: '第二季度' },
        { dictKey: '3', dictKeyName: '第三季度' },
        { dictKey: '4', dictKeyName: '第四季度' },
    ];

    years: any[] = [
        { dictKey: '1', dictKeyName: '上半年' },
        { dictKey: '2', dictKeyName: '下半年' },
        { dictKey: '3', dictKeyName: '年' },
    ];
    value2: number = 0;
    type: any = '';
    value1: any = null;
    loading: boolean = false;
    visible: boolean = false;
    activeTab: string = 'branch';
    checkList: any = [];
    selectedArrList: any = [];
    // 当前账户类型
    accountControlTypeSelect: any = {
        '0': {
            '0': '单产品控制',
            '1': '多产品控制',
        },
        '1': {
            '0': '单产品控制',
            '2': '产品组内联合控制',
            '3': '产品组间联合控制',
        },
        // '4':'投资组合组组内投资组合联合控制'
        // '5':'产品组内单、多产品联合控制',
        // '6':'产品组间单、多产品联合控制'
        '2': {
            '7': '单资产单元控制',
            '8': '多资产单元联合控制',
            '16': '单资产单元、多资产单元联合控制',
        },
        '3': {
            '7': '单资产单元控制',
            '9': '资产单元组内资产单元联合控制',
            '10': '资产单元组间资产单元联合控制',
            // '11': '资产单元组内按基金联合控制',
            '17': '资产单元组内单、多资产单元联合控制',
            '18': '资产单元组间单、多资产单元联合控制',
        },
        '4': {
            '12': '单组合控制',
            '13': '多组合联合控制',
            '19': '单投资组合、多投资组合联合控制',
        },
        '5': {
            '12': '单组合控制',
            '14': '投资组合组组内投资组合联合控制',
            '15': '投资组合组组间投资组合联合控制',
            '20': '投资组合组内单、多投资组合联合控制',
            '21': '投资组合组间单、多投资组合联合控制',
        },
        '11': {
            '0': '单产品控制',
        },
    };

    // 当风险类型为同向反向时, 产品组内为02356
    private entryType3AccountControlTypes: any = {
        // '4': '单产品、多产品联合控制',
        '5': '产品组内单、多产品联合控制',
        '6': '产品组间单、多产品联合控制',
    };

    // 当风险类型为同向反向时, 产品内为014
    private entryType3AccountControlTypes1: any = {
        '4': '单产品、多产品联合控制',
    };

    entryControl: any = {
        entryName: '', // 风险说明
        entryType: '0', // 风险类型
        entryTagIds: [], // 条目便签
        entryStatusValid: true, // 启用状态
        premise: false, // 前提条目
        level: 5, // 优先级
        beginDate: '', // 生效日期
        endDate: '', // 失效日期
        controlGrade: '0', // 风险等级
        originalAccountId: '0', // 账户层次
        accountControlType: '0', // 控制类型
        accountControlValue: '', // '控制账户' : '账户组'
        accountDebarValue: '', // 排除账户
        accountGroupDebarValue: '', // 排除账户组
        thresholdType1: '3', // 触警操作1
        thresholdValue1: undefined, // 阈值1
        thresholdType2: '', // 触警操作2
        thresholdValue2: undefined, // 阈值2
        thresholdType3: '', // 触警操作3
        thresholdValue3: undefined, // 阈值3
        saThresholdType: '3', // 触警操作4
        saThresholdValue: undefined, // 阈值4
        compareType: '0', // 比较方向
        riskCalTypes: ['0', '1'], // 作用范围
        unit: '',
        isCycle: '0', // 是否循环
        dateType: '',
        controlValue: '',
        usableSubstitute: '',
        occupySubstitute: '',
        premiseRelation: '0', // 并且或者

        assetCodeDebarValue: [], // 排除资产单元编号
        fdAcCodeDebarValue: [], // 排除组合编码

        assetGroupDebarValue: [], // 排除资产单元组
        fdAcGroupDebarValue: [], // 排除组合组编号
        checkReason: '', // 复核备注原因
        useO32No: '', // 对应O32风控序号
        useO32Cal: false,
        prohibitionReset: '1', // 重置连续违规天数

        remarkInfo: { changeBigTypes_: '', adjustReason: '' },
        relatedClause: [],
    };
    riskCustomSetting: any = {};
    riskEntryControlRelation: any = {
        joinRiskEntryControls: [], // 联合设置
        mutualRiskEntryControls: [], // 互斥设置
        premiseRiskEntryControls: [],
    };
    prohibitionReset: boolean = false; // 重置连续违规天数disabled
    riskEntryBranchs: any[] = []; // 分支设置
    entryParams: any[] = []; // 高级设置
    fundRanges: any[] = []; // 范围配置
    riskCustomSettings: any = {};

    entryType: any[] = []; // 风险类型数组
    controlGrade: any[] = []; // 风险等级数组
    compareDirection: any[] = []; // 比较方向数组
    originalAccountType: any[] = []; // 账户层次数组

    thresholdType: any[] = []; // 触警操作
    unitFilter: any = []; // 操作值后面的选项
    fundInfo: any[] = []; // 基金信息
    fundInfo2: any[] = []; // 基金信息
    fundGroup: any[] = []; // 基金组信息

    assetGroup: any[] = []; // 资产单元组合
    fdAcGroup: any[] = []; // 投资单元组合

    stockBound: any[] = []; // 范围属性组集合
    branchData: any[] = []; // 分支设置中分支数组

    riskEntryBranchList: any[] = [];
    entryParamsList: any[] = [];
    fundRangesList: any[] = [];
    joinRiskEntryControls: any[] = [];
    premiseRelations: string = '0';

    // 复核编辑
    postData: any = {
        entryControl: null,
        riskEntryControlRelation: null,
        riskEntryBranchs: null,
        entryParams: null,
        fundRanges: null,
        historyNo: null,
        modifyType: null,
        changeNo: null,
        serialNo: null,
    };
    sbmitdisabled: boolean = false;
    accountControlType0: any[] = [];
    Accountdisabled: boolean = false;
    AccountdisabledAll: boolean = false;
    Accountdisabled2: boolean = false;
    AccountdisabledAll2: boolean = false;
    // showDisdata: boolean = false;
    colList: any = {
        col1: 4,
        col2: 4,
        col3: 4,
    };
    entryTagIdList: any = [];
    docking: boolean = false;
    verification: boolean = false;
    verificationTitle: string = '';
    verifiData: any = null;
    riskControlItem: any = null;
    editDatas: any = {};

    private tooltipFunds: any[] = []; // 控制账户tooltip
    private tooltipFunds2: any[] = []; // 控制账户tooltip
    // private userCode: string = '';

    SHOW_SECURITY = getConfigItem('SHOW_SECURITY');
    thresholdValues: any[] = []; // 控制值
    fundGroupTreeData: any[] = []; // 账户组数据树
    innerGroupTypeData: any[] = []; // 风控内部组类型
    fundGroupTreeData1: any[] = []; // 账户组数据树
    fundGroupTreeData2: any[] = []; // 排除账户组数据树
    parentCode: any[] = [];
    selectedInnerGroupType1: any[] = [];
    selectedInnerGroupType2: any[] = [];
    treeData1: any[] = [];
    treeData2: any[] = [];
    // 提醒内容
    entryParamsl: any = {
        paramType: 'l',
        paramValue: '',
        compareType: 0,
    };

    fundInfoSelect: any = { data: [], label: 'label', value: 'fundCode' };
    fundInfoSelect2: any = { data: [], label: 'label', value: 'fundCode' };
    assetGroupSelect: any = { data: [], label: 'dictKeyName', value: 'dictKey' }; // 资产单元组合
    fdAcGroupSelect: any = { data: [], label: 'dictKeyName', value: 'dictKey' }; // 资产单元组合

    get userInfo(): IUserInfo {
        return UserModule.userInfo;
    }

    get showDisdata() {
        if (['edit', 'editCheck', 'check-look', 'editCheckSetting'].includes(this.itemData.type) && this.entryControl.sourceType === '2') {
            return true;
        }
        return ['look', 'lookCheck', 'check-look', 'history-look'].includes(this.itemData.type);
    }

    get urlH() {
        return '/entry';
    }
    created() {
        this.getDockings();
        this.$emit('getPageType', this.itemData.type);
    }

    async mounted() {
        this.getMemory();
        // console.time('主要');
        // this.userCode = this.itemData.content.modifyUserCode
        // 风险等级
        this.compareDirection = DictionConstUtil.PojoToList(DictionConstUtil.CompareDirection).filter(item =>
            ['5', '3'].includes(this.entryControl.entryType) ? item.dictKey === '6' : !['4', '5', '6'].includes(item.dictKey)
        );
        await this.getDict();
        this.getEntryDetail();
        // if (
        //     this.itemData.type == 'look' ||
        //     this.itemData.type == 'lookCheck' ||
        //     this.itemData.type == 'check-look' ||
        //     this.itemData.type == 'history-look'
        // ) {
        //     this.showDisdata = true;
        // } else {
        //     this.showDisdata = false;
        // }

        this.innerGroupTypeData = await SGU_CACHE('innerGroupType', '/dict/list/code/Y_000301', []);
        await this.getFundGroupListTemp();
        this.fundGroupTreeData1 = this.getAccountTreeData('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
        this.fundGroupTreeData2 = this.getAccountTreeData(
            '2',
            this.entryControl.accountGroupDebarValue,
            this.selectedInnerGroupType2,
            this.treeData2
        );

        // console.timeEnd('主要');
    }
    // @Watch('entryControl.prohibitionReset', { immediate: true, deep: true })
    // onWatchprohibitionReset(newValue, oldValue) {}
    @Watch('entryControl.accountControlValue', { immediate: true, deep: true })
    onWatchAccountTree1(newValue, oldValue) {
        if (!this.entryControl.accountControlValue) {
            this.selectedInnerGroupType1 = [];
        }
        this.fundGroupTreeData1 = this.getAccountTreeData('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
    }

    @Watch('entryControl.accountGroupDebarValue', { immediate: true, deep: true })
    onWatchAccountTree2(newValue, oldValue) {
        if (!this.entryControl.accountGroupDebarValue) {
            this.selectedInnerGroupType2 = [];
        }
        this.fundGroupTreeData2 = this.getAccountTreeData(
            '2',
            this.entryControl.accountGroupDebarValue,
            this.selectedInnerGroupType2,
            this.treeData2
        );
    }

    async getDict() {
        this.entryType = DictionConstUtil.PojoToList(DictionConstUtil.EntryType);
        this.controlGrade = DictionConstUtil.PojoToList(DictionConstUtil.ControlGrade);

        let acc = this.SHOW_SECURITY ? DictionConstUtil.RemoldOriginalAccountType : DictionConstUtil.OriginalAccountType;
        this.originalAccountType = DictionConstUtil.PojoToList(acc);

        this.thresholdType = DictionConstUtil.PojoToList(DictionConstUtil.ThresholdType).filter(item => item.dictKey !== '4');
        this.unitFilter = DictionConstUtil.UnitFilter;

        let funds: any = await SGU_CACHE('FundInfo', '/fundInfo/list', []);
        let fundInfo = [];
        for (let i = 0; i < funds.length; i++) {
            fundInfo.push({ label: funds[i].fundCode + funds[i].fundNameSt, value: funds[i].fundCode, fundCode: funds[i].fundCode });
        }
        this.fundInfo = fundInfo;
        this.fundInfoSelect.data = [{ label: '选择全部', fundCode: '-1' }, ...fundInfo];
        // this.fundInfo2 = fundInfo;
        this.fundInfoSelect2.data = [{ label: '选择全部', fundCode: '-1' }, ...fundInfo];

        // 账户组合
        this.getFundGroupList();
        // this.fundGroup = ((await FNFundGroup()) as any).map(item => {
        //     item.dictKeyName = item.fundGroupName;
        //     item.dictKey = item.fundGroupCode;
        //     return item;
        // });

        if (this.SHOW_SECURITY) {
            // 资产单元组
            this.$axios.get('/assetGroup/list').then((res: any) => {
                this.assetGroupSelect.data = (res || []).map(item => {
                    item.dictKey = item.assetGroupCode;
                    item.dictKeyName = item.assetGroupCode + ' ' + item.assetGroupName;
                    return item;
                });
            });

            // 投资单元组
            this.$axios.get('fdAcGroup/list').then((res: any) => {
                this.fdAcGroupSelect.data = (res || []).map(item => {
                    item.dictKey = item.fdAcGroupCode;
                    item.dictKeyName = item.fdAcGroupCode + ' ' + item.fdAcGroupName;
                    return item;
                });
            });
        }
    }

    // 树形下拉节点映射
    normalizer(node) {
        return {
            id: node.fundGroupCode,
            label: node.fundGroupCode,
            children: node.children,
        };
    }

    // 树形下拉收缩tag显示文字
    limitText(count) {
        return `+${count}`;
    }

    // 获取产品组(临时)
    private async getFundGroupListTemp() {
        await this.$axios.post('/fundGroup/list').then((res: any) => {
            let innerGroupTypePojo = {
                '0': '00',
                '1': '01',
                '2': '02',
                '3': '03',
            };
            this.parentCode = this.innerGroupTypeData.map(item => {
                item.label = item.dictKeyName;
                item.id = innerGroupTypePojo[item.dictKey];
                return item;
            });
            // 账户组合
            let treeData = res.map(item => {
                item.label = item.fundGroupCode + ' ' + item.fundGroupName;
                item.id = item.fundGroupCode;
                // 一级分类id会和产品组id重复，需要做映射
                item.innerGroupType = innerGroupTypePojo[item.innerGroupType];
                return item;
            });
            this.treeData1 = JSON.parse(JSON.stringify(treeData));
            this.treeData2 = JSON.parse(JSON.stringify(treeData));
        });
    }

    /**
     * 构建账户组树形数据
     * @param type -- 1、账户组 2、排除账户组
     * @param value -- 选中值
     * @param groupType -- 选中分组
     * @param data --一维数组数据
     */
    getAccountTreeData(type, value, groupType, treeData) {
        treeData = treeData.concat(this.parentCode);
        // 设置已勾选子节点前置
        if (value && value.length) {
            treeData = changeOptions(value, treeData, 'id');
        }
        // 将数组转树结构
        let fundGroupTreeData = toArrayTree(treeData, { strict: true, key: 'id', parentKey: 'innerGroupType' });
        // 设置组节点前置
        fundGroupTreeData = changeOptions(groupType, fundGroupTreeData, 'id');
        // 当一级分类下无子节点时，设置该分类节点不显示
        fundGroupTreeData = fundGroupTreeData.filter(ele => ele.children && ele.children.length);
        return fundGroupTreeData;
    }

    // 账户组选中事件
    handleAccountGroupTreeSelect(node) {
        let exist: boolean;
        // 判断勾选的是否是父节点（全选分组）
        if (node.fundGroupCode) {
            // 判断选中的已选节点的分组是否已被勾选
            exist = this.selectedInnerGroupType1.some(ele => ele === node.innerGroupType);
            if (!exist) {
                this.selectedInnerGroupType1.push(node.innerGroupType);
            }
        } else {
            exist = this.selectedInnerGroupType1.some(ele => ele === node.id);
            if (!exist) {
                this.selectedInnerGroupType1.push(node.id);
            }
        }
        this.fundGroupTreeData1 = this.getAccountTreeData('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
    }

    // 账户组取消选中事件
    handleAccountGroupTreeDeSelect(node) {
        if (node.fundGroupCode) {
            // 判断选中的已选节点的分组是否已被勾选
            this.selectedInnerGroupType1 = Array.from(new Set(this.selectedInnerGroupType1));
        } else {
            this.selectedInnerGroupType1 = this.selectedInnerGroupType1.filter(item => item !== node.id);
        }
        this.fundGroupTreeData1 = this.getAccountTreeData('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
    }

    // 账户组展开下拉面板
    handleAccountGroupTreeOpen() {
        if (this.entryControl.accountControlValue && this.entryControl.accountControlValue.length) {
            this.selectedInnerGroupType1 = [];
            this.entryControl.accountControlValue.forEach(ele => {
                this.treeData1.forEach(item => {
                    if (ele === item.id) {
                        this.selectedInnerGroupType1.push(item.innerGroupType);
                    }
                });
            });
        }
        this.fundGroupTreeData1 = this.getAccountTreeData('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
    }

    // 账户组清除事件
    // handleAccountGroupClearAll() {
    //     this.selectedInnerGroupType1 = [];
    //     this.fundGroupTreeData1 = this.getAccountTreeDassta('1', this.entryControl.accountControlValue, this.selectedInnerGroupType1, this.treeData1);
    // }

    // 排除账户组选中事件
    handleAccountGroupDebarTreeSelect(node) {
        let exist: boolean;
        if (node.fundGroupCode) {
            // 判断选中的已选节点的分组是否已被勾选
            exist = this.selectedInnerGroupType2.some(ele => ele === node.innerGroupType);
            if (!exist) {
                this.selectedInnerGroupType2.push(node.innerGroupType);
            }
        } else {
            exist = this.selectedInnerGroupType2.some(ele => ele === node.id);
            if (!exist) {
                this.selectedInnerGroupType2.push(node.id);
            }
        }
        this.fundGroupTreeData2 = this.getAccountTreeData(
            '2',
            this.entryControl.accountGroupDebarValue,
            this.selectedInnerGroupType2,
            this.treeData2
        );
    }

    // 排除账户组取消选中事件
    handleAccountGroupDebarTreeDeSelect(node) {
        if (node.fundGroupCode) {
            // 判断选中的已选节点的分组是否已被勾选
            this.selectedInnerGroupType2 = Array.from(new Set(this.selectedInnerGroupType2));
            // this.selectedInnerGroupType2 = this.selectedInnerGroupType2.filter(item => item !== node.innerGroupType);
        } else {
            this.selectedInnerGroupType2 = this.selectedInnerGroupType2.filter(item => item !== node.id);
        }
        this.fundGroupTreeData2 = this.getAccountTreeData(
            '2',
            this.entryControl.accountGroupDebarValue,
            this.selectedInnerGroupType2,
            this.treeData2
        );
    }

    // 排除账户组展开下拉面板
    handleAccountGroupDebarTreeOpen() {
        if (this.entryControl.accountGroupDebarValue && this.entryControl.accountGroupDebarValue.length) {
            this.selectedInnerGroupType2 = [];
            this.entryControl.accountGroupDebarValue.forEach(ele => {
                this.treeData2.forEach(item => {
                    if (ele === item.id) {
                        this.selectedInnerGroupType2.push(item.innerGroupType);
                    }
                });
            });
        }
        this.fundGroupTreeData2 = this.getAccountTreeData(
            '2',
            this.entryControl.accountGroupDebarValue,
            this.selectedInnerGroupType2,
            this.treeData2
        );
    }

    beforeDestroy() {}

    prohOriginalAccoundId: boolean = true; // 禁止监听变化

    //  { immediate: true }
    // 监听账户层次
    @Watch('entryControl.originalAccountId')
    changOriginalAccoutId(newValue, oldValue) {
        if (this.prohOriginalAccoundId || (!newValue && !oldValue)) {
            return;
        }
        // 切换为产品的时候设置全部选项都可选
        this.Accountdisabled = false;
        this.AccountdisabledAll = false;

        if (
            (['0', '1'].includes(oldValue) && ['0', '1'].includes(newValue)) ||
            (['2', '3'].includes(oldValue) && ['2', '3'].includes(newValue)) ||
            (['4', '5'].includes(oldValue) && ['4', '5'].includes(newValue))
        ) {
            // this.entryControl.accountControlType = '';
            this.entryControl.accountControlValue = [];
        } else {
            this.entryControl = {
                ...this.entryControl,
                // accountControlType: '',
                accountControlValue: [],
                accountDebarValue: [],
                accountGroupDebarValue: [],
                assetCodeDebarValue: [],
                assetGroupDebarValue: [],
                fdAcCodeDebarValue: [],
                fdAcGroupDebarValue: [],
            };
            this.broadcast('RiskBranchSetting', 'setentryTypes', this.entryControl.entryType);
        }
        // 清空弹窗tooltip
        this.tooltipFunds = [];
        // entryBranch.branchName
        let values = this.accountControlTypeSelect[this.entryControl.originalAccountId];

        this.entryControl.accountControlType = values && Object.keys(values)[0];
        this.deBarKey++;
    }

    deBarKey: number = -1; // 排除项

    dictKey: string = 'fundCode';
    dictKeyName: string = 'fundNameSt';

    @Watch('thresholdValues', { immediate: true, deep: true })
    onWatchThresholdValues(newValue, oldValue) {
        if (newValue.length !== (oldValue || []).length) {
            if (
                this.entryControl.usableSubstitute &&
                // eslint-disable-next-line no-template-curly-in-string
                (this.entryControl.usableSubstitute.indexOf('${A}') != -1 ||
                    // eslint-disable-next-line no-template-curly-in-string
                    this.entryControl.usableSubstitute.indexOf('${B}') != -1 ||
                    // eslint-disable-next-line no-template-curly-in-string
                    this.entryControl.usableSubstitute.indexOf('${C}') != -1)
            ) {
                // 配置公式涉及控制值
                this.yh_message_warn('条目控制值变动，可投余量可能需要进行调整');
            }
        }
    }

    // 获取产品组
    private getFundGroupList(): void {
        this.$axios.post('/fundGroup/list').then((res: any) => {
            this.fundGroup = res.map(item => {
                item.dictKeyName = item.fundGroupName;
                item.dictKey = item.fundGroupCode;
                return item;
            });
        });
    }

    // 获取api
    getAccountControlValueAPI() {
        if (['0', '1'].includes(this.entryControl.originalAccountId)) {
            this.dictKey = 'fundCode';
            this.dictKeyName = 'fundNameSt';
            return '/fundInfo/list/byUser/like?fundCodeOrName=';
        } else if (['2', '3'].includes(this.entryControl.originalAccountId)) {
            this.dictKey = 'assetCode';
            this.dictKeyName = 'assetName';
            return '/asset/list/byFundCode/like?assetCodeOrName=';
        } else if (['4', '5'].includes(this.entryControl.originalAccountId)) {
            this.dictKey = 'fundAccountCode';
            this.dictKeyName = 'fundAccountName';
            return '/fdAc/list/byFundCode/like?fdAcCodeOrName=';
        }
    }

    // 排除(账户)回调
    getSingleAccountDebarValue(val) {
        if (['0', '1'].includes(this.entryControl.originalAccountId)) {
            this.entryControl.accountDebarValue = val;
        } else if (['2', '3'].includes(this.entryControl.originalAccountId)) {
            this.entryControl.assetCodeDebarValue = val;
        } else {
            this.entryControl.fdAcCodeDebarValue = val;
        } //
    }

    // 给排除项的值
    getReturnDatas() {
        if (['0', '1'].includes(this.entryControl.originalAccountId)) {
            return this.entryControl.accountDebarValue;
        } else if (['2', '3'].includes(this.entryControl.originalAccountId)) {
            return this.entryControl.assetCodeDebarValue;
        } else {
            return this.entryControl.fdAcCodeDebarValue;
        }
    }

    // label值
    getAccountControlValueLabel() {
        return DictionConstUtil.RemoldOriginalAccountType[this.entryControl.originalAccountId];
    }

    // 排除项label值
    getAccountIdLabel() {
        if (['0', '1'].includes(this.entryControl.originalAccountId)) {
            return '排除账户';
        } else if (['2', '3'].includes(this.entryControl.originalAccountId)) {
            return '排除资产单元';
        } else {
            return '排除投资组合';
        }
    }

    // 获取当前环境
    getDockings() {
        // let docking = getConfigItem('WEB_DOCKING');
        // // 永赢 MAXWEALTH
        // if (docking == 'MAXWEALTH') {
        //     this.docking = true;
        //     // this.colList = {
        //     //     col1: 4,
        //     //     col2: 4,
        //     //     col3: 4,
        //     // };
        // } else {
        //     this.docking = false;
        //     // this.colList = {
        //     //     col1: 0,
        //     //     col2: 6,
        //     //     col3: 6,
        //     // };
        // }
        this.$axios.get('/entryTag/queryAll').then(res => {
            this.entryTagIdList = res;
        });
    }

    // 阈值回调
    getInputNumber(args: any) {
        let value = args[0];
        let field = args[1];
        if (field === 'thresholdValue1') {
            this.entryControl.thresholdValue1 = value;
        } else if (field === 'thresholdValue2') {
            this.entryControl.thresholdValue2 = value;
        } else if (field === 'thresholdValue3') {
            this.entryControl.thresholdValue3 = value;
        } else if (field === 'saThresholdValue') {
            this.entryControl.saThresholdValue = value;
        }
        this.thresholdValues = [
            this.entryControl.thresholdValue1,
            this.entryControl.thresholdValue2,
            this.entryControl.thresholdValue3,
            this.entryControl.saThresholdValue,
        ];
        this.thresholdValues = this.thresholdValues.filter(ele => ele !== undefined && ele !== '');
    }

    // 给组件传参
    handleChang(type: string, val: any) {
        if (type === 'entryType') {
            this.entryControl.unit = '';
            // 可选账户层次
            if (val == '10' || !this.SHOW_SECURITY) {
                this.originalAccountType = DictionConstUtil.PojoToList(DictionConstUtil.OriginalAccountType);
                if (!['0', '1'].includes(this.entryControl.originalAccountId)) {
                    // this.changOriginalAccoutId('0', this.entryControl.originalAccountId);
                    this.entryControl.originalAccountId = '0';
                }
            } else if (val == '11' || !this.SHOW_SECURITY) {
                this.originalAccountType = DictionConstUtil.PojoToList(DictionConstUtil.OriginalAccountType);
                this.entryControl.originalAccountId = '0';
            } else if (this.SHOW_SECURITY) {
                this.originalAccountType = DictionConstUtil.PojoToList(DictionConstUtil.RemoldOriginalAccountType);
            }

            // 可选比较方向
            if (['3', '5'].includes(val)) {
                this.entryControl.compareType = '6';
                this.entryControl.thresholdValue1 = '';
            } else {
                this.entryControl.compareType = '0';
                this.entryControl.thresholdValue1 = undefined;
            }
            this.compareDirection = DictionConstUtil.PojoToList(DictionConstUtil.CompareDirection).filter(item =>
                ['5', '3'].includes(this.entryControl.entryType) ? item.dictKey === '6' : !['4', '5', '6'].includes(item.dictKey)
            );

            if (this.entryControl.entryType === '3' || this.entryControl.entryType === '10') {
                this.entryControl.riskCalTypes = ['1'];
            } else {
                this.entryControl.riskCalTypes = ['0', '1'];
            }

            // 同向反向 => 不允许 联合互斥前提

            this.broadcast('HighSetting', 'addTables', val);
            this.broadcast('RiskBranchSetting', 'setentryTypes', val);
            this.broadcast('UniteSetting', 'setentryTypes', val);
            this.broadcast('MutexSetting', 'setentryTypes', val);
        }
    }

    // 高级设置组件参数回调this.riskEntryBranchs
    getHighdata(data: any) {
        this.entryParams = data;

        if (this.entryControl.entryType === '3') {
            if (this.entryControl.riskCalTypes.includes('0')) {
                const controlModel = this.entryParams.find(i => i.paramType === '7')?.paramValue;
                if (controlModel && controlModel !== '1') {
                    this.yh_message_warn('同向反向静态 不支持除有买有卖模式以外的模式!');
                    this.entryControl.riskCalTypes = this.entryControl.riskCalTypes.filter(i => i !== '0');
                }
            }
        }
    }

    // 分支设置中分支的回调
    getBranchData(data: any) {
        let oldBranch = this.riskEntryBranchs.map(ele => ele.entryBranch);
        let newBranch = data.map(ele => ele.entryBranch);
        if (JSON.stringify(oldBranch) !== JSON.stringify(newBranch) && this.riskEntryBranchs.length) {
            let reg = /\d/;
            if (this.entryControl.usableSubstitute && reg.test(this.entryControl.usableSubstitute)) {
                // 当配置了可投余量，且公式中涉及分支
                this.yh_message_warn('条目分支变动，可投余量可能需要进行调整');
            }
        }
        this.branchData = JSON.parse(JSON.stringify(data));
        this.riskEntryBranchs = JSON.parse(JSON.stringify(data));
    }

    // 可投余量的回调
    getUserData(data: any) {
        this.entryControl.usableSubstitute = data;
    }

    // 已占用额
    getOccupyData(data: any) {
        this.entryControl.occupySubstitute = data;
    }

    // 自定义设置回调
    getUserDefindedData(data: any) {
        this.riskCustomSetting = data;
    }

    // 联合设置回调
    getUniteData(data: any) {
        this.riskEntryControlRelation.joinRiskEntryControls = data;
    }

    // 前提条目
    getPremiseData(data: any) {
        this.riskEntryControlRelation.premiseRiskEntryControls = data.tabData;
        this.entryControl.premiseRelation = data.premiseRelation;
    }

    // 互斥设置回调
    getMutexData(data: any) {
        this.riskEntryControlRelation.mutualRiskEntryControls = data;
    }

    // 基金范围回调
    onHandleOperateOver(value: any): void {
        this.fundRanges = value;
    }

    /**
     * 备注回调
     */
    submitContent(value: string): void {
        this.entryControl.content = value;
    }

    /**
     * 备注信息回调
     */
    setRemarkInfo(value: string): void {
        this.entryControl.remarkInfo = value;
    }

    /**
     * 关联条款回调
     */
    setRelatedClause(value: string): void {
        this.entryControl.relatedClause = value;
    }

    /**
     * 改变日期类型
     */
    handleBaseInfo(value: any) {
        if (value === 'month') {
            this.type = 'month';
            this.typeDetails = this.months;
        } else if (value === 'season') {
            this.type = 'season';
            this.typeDetails = this.seasons;
        } else if (value === 'year') {
            this.type = 'year';
            this.typeDetails = this.years;
        } else {
            this.type = '0';
            this.typeDetails = [];
        }
        this.entryControl.dateType = '';
        this.changeDate(this.entryControl.dateType);
    }

    // // 获取数据
    // getAccountDebarValue(val: any) {
    //     this.entryControl.accountDebarValue = val;
    // }

    getAccountControlValue(val: any) {
        this.entryControl.accountControlValue = val;
    }

    // getAccountGroupDebarValue(val: any) {
    //     this.entryControl.accountGroupDebarValue = val;
    // }

    // 监听前提条件
    changPremise(val: any) {
        if (this.riskEntryControlRelation.joinRiskEntryControls && this.riskEntryControlRelation.joinRiskEntryControls.length > 0) {
            this.yh_message_success('存在配置了的被前提条目，无法修改为被前提条目');
            this.entryControl.premise = !val;
            return;
        } else if (this.riskEntryControlRelation.mutualRiskEntryControls && this.riskEntryControlRelation.mutualRiskEntryControls.length > 0) {
            this.yh_message_success('存在配置了的被前提条目，无法修改为被前提条目');
            this.entryControl.premise = !val;
            return;
        } else if (this.riskEntryControlRelation.premiseRiskEntryControls && this.riskEntryControlRelation.premiseRiskEntryControls.length > 0) {
            this.yh_message_success('存在配置了的被前提条目，无法修改为被前提条目');
            this.entryControl.premise = !val;
            return;
        }
        if (this.entryControl.premise) {
            this.thresholdType = this.thresholdType.filter(item => item.dictKey === '3');
            this.entryControl.thresholdType1 && (this.entryControl.thresholdType1 = '3');
            this.entryControl.thresholdType2 && (this.entryControl.thresholdType2 = '3');
            this.entryControl.thresholdType3 && (this.entryControl.thresholdType3 = '3');
        } else {
            this.thresholdType = DictionConstUtil.PojoToList(DictionConstUtil.ThresholdType).filter(item => item.dictKey !== '4');
        }
    }

    /**
     * 改变控制值
     */
    changeDate(value: any): void {
        const year = new Date().getFullYear();
        const type = this.type;
        const date = new Date(year, value, 0);
        const days = date.getDate();
        let beginDate;
        let endDate;
        let type1: any = 0;
        this.value1 = value;
        if (type === 'month') {
            type1 = '1';
            if (parseInt(value) < 10 && parseInt(value) > 0) {
                beginDate = year + '0' + value + '01';
                endDate = year + '0' + value + days;
            } else if (parseInt(value) >= 10) {
                beginDate = year + value + '01';
                endDate = year + value + days;
            } else {
                beginDate = '';
                endDate = '';
            }
        } else if (type === 'season') {
            type1 = '2';
            if (value === '1') {
                beginDate = year + '0101';
                endDate = year + '0331';
            } else if (value === '2') {
                beginDate = year + '0401';
                endDate = year + '0630';
            } else if (value === '3') {
                beginDate = year + '0701';
                endDate = year + '0930';
            } else if (value === '4') {
                beginDate = year + '1001';
                endDate = year + '1231';
            } else {
                beginDate = '';
                endDate = '';
            }
        } else if (type === 'year') {
            type1 = '3';
            if (value === '1') {
                beginDate = year + '0101';
                endDate = year + '0630';
            } else if (value === '2') {
                beginDate = year + '0701';
                endDate = year + '1231';
            } else if (value === '3') {
                beginDate = year + '0101';
                endDate = year + '1231';
            } else {
                beginDate = '';
                endDate = '';
            }
        }
        this.entryControl.beginDate = beginDate;
        this.entryControl.endDate = endDate;
    }

    // 触警操作1
    changeThresholdType(val) {
        let value1 = this.entryControl.thresholdType1;
        let value2 = this.entryControl.thresholdType2;
        let value3 = this.entryControl.thresholdType3;

        if (value2 < value1) {
            this.entryControl.thresholdType2 = '';
            if (value3 < value1) {
                this.entryControl.thresholdType3 = '';
            }
        }
    }

    // 触警操作2
    changeThresholdType2(val) {
        let value2 = this.entryControl.thresholdType2;
        let value3 = this.entryControl.thresholdType3;
        if (value3 < value2) {
            this.entryControl.thresholdType3 = '';
        }
    }

    // "确认"
    async submitVerification() {
        let entryParamsData = JSON.parse(JSON.stringify(this.entryParams));
        this.loading = true;
        this.selectedArrList = [];
        // 处理数据格式 把值转为字符串
        for (let i = 0; i < entryParamsData.length; i++) {
            // eslint-disable-next-line no-mixed-operators
            if (
                entryParamsData[i].paramType === 'e' ||
                entryParamsData[i].paramType === '2' ||
                entryParamsData[i].paramType === '3' ||
                (entryParamsData[i].paramType === '4' && entryParamsData[i].paramValue)
            ) {
                entryParamsData[i].paramValue = entryParamsData[i].paramValue.toString();
            }
        }
        // 风险类型为11-触发控制类
        if (this.entryControl.entryType == '11' && this.entryParamsl.paramValue != '') {
            entryParamsData.push(this.entryParamsl);
        }

        let realEntryControl = {};

        if (this.entryControl.unit === '%') {
            let thresholdValueObj = {
                thresholdValue1: this.entryControl.thresholdValue1
                    ? accDiv(this.entryControl.thresholdValue1, 100)
                    : this.entryControl.thresholdValue1,

                thresholdValue2: this.entryControl.thresholdValue2
                    ? accDiv(this.entryControl.thresholdValue2, 100)
                    : this.entryControl.thresholdValue2,
                thresholdValue3: this.entryControl.thresholdValue3
                    ? accDiv(this.entryControl.thresholdValue3, 100)
                    : this.entryControl.thresholdValue3,
                saThresholdValue: this.entryControl.saThresholdValue
                    ? accDiv(this.entryControl.saThresholdValue, 100)
                    : this.entryControl.saThresholdValue,
            };
            realEntryControl = { ...this.entryControl, ...thresholdValueObj };
        } else if (['万元', '万股'].includes(this.entryControl.unit)) {
            let thresholdValueObj = {
                thresholdValue1: this.entryControl.thresholdValue1
                    ? accMul(this.entryControl.thresholdValue1, 10000)
                    : this.entryControl.thresholdValue1,
                thresholdValue2: this.entryControl.thresholdValue2
                    ? accMul(this.entryControl.thresholdValue2, 10000)
                    : this.entryControl.thresholdValue2,
                thresholdValue3: this.entryControl.thresholdValue3
                    ? accMul(this.entryControl.thresholdValue3, 10000)
                    : this.entryControl.thresholdValue3,
                saThresholdValue: this.entryControl.saThresholdValue
                    ? accMul(this.entryControl.saThresholdValue, 10000)
                    : this.entryControl.saThresholdValue,
            };
            realEntryControl = { ...this.entryControl, ...thresholdValueObj };
        } else {
            realEntryControl = this.entryControl;
        }

        let data = {
            // entryControl: this.entryControl,
            entryControl: realEntryControl,
            riskEntryControlRelation: this.riskEntryControlRelation,
            riskEntryBranchs: this.riskEntryBranchs,
            entryParams: entryParamsData,
            fundRanges: this.fundRanges,
            riskCustomSetting: this.riskCustomSetting,
        };

        let verify = await Control.verifyItemDetailParam(data, false);
        if (verify !== 'SUCCESS') {
            this.sbmitdisabled = false;
            this.loading = false;
            this.yh_message_error(verify);
            return;
        }

        if (this.itemData.type === 'add' || this.itemData.type === 'copy') {
            this.submitData();
        } else {
            this.selectedArrList.push({
                entryCode: this.verifiData.entryControl.entryCode,
            });
            let daats = {
                before: this.verifiData,
                after: data,
            };
            await this.$axios.post(this.urlH + '/queryProhibitionReset', daats).then((res: any) => {
                this.entryControl.prohibitionReset = res;
                this.prohibitionReset = res == '1';
            });

            this.$axios
                .post(this.urlH + '/compare', daats)
                .then((res: any) => {
                    this.loading = false;
                    if (JSON.stringify(res) == '{}') {
                        this.yh_message_success('条目无修改！');
                    } else {
                        this.editDatas = res;
                        this.verificationTitle = '确认提交更新吗';
                        this.verification = true;
                    }
                })
                .catch(() => {
                    this.loading = false;
                });
        }

        // 计算维度为证券时，作为分母的因子在未配置任何范围条件时需要给出提示
        this.riskEntryBranchs.forEach(ele => {
            let entryBanchS = ele.entryBranch;
            let entryBranchConfigs = ele.entryBranchConfigs;
            if (entryBanchS.countType === '3') {
                const verifyCalfactors = Object.keys(DictionConstUtil.verifyCalfactor);
                if (verifyCalfactors.includes(entryBanchS.factorCode) && !entryBranchConfigs.length) {
                    setTimeout(() => {
                        this.yh_message_warn('“' + entryBanchS.branchName + '”' + '未配置范围条件');
                    }, 400);
                }
            }
        });
    }

    submitVerificationData() {
        if (this.itemData.type == 'lookCheck') {
            if (this.verificationTitle == '确认复核通过以下条目吗') {
                this.reCheckReset('1', this.entryControl);
            } else if (this.verificationTitle == '确认复核拒绝以下条目吗') {
                this.reCheckReset('2', this.entryControl);
            }
        } else {
            this.submitData();
        }
    }

    // 提交
    async submitData() {
        this.sbmitdisabled = true;
        let entryParamsData = JSON.parse(JSON.stringify(this.entryParams));
        // 处理数据格式 把值转为字符串
        for (let i = 0; i < entryParamsData.length; i++) {
            // eslint-disable-next-line no-mixed-operators
            if (
                entryParamsData[i].paramType === 'e' ||
                entryParamsData[i].paramType === '2' ||
                entryParamsData[i].paramType === '3' ||
                (entryParamsData[i].paramType === '4' && entryParamsData[i].paramValue)
            ) {
                entryParamsData[i].paramValue = entryParamsData[i].paramValue.toString();
            }
        }
        // 风险类型为11-触发控制类
        if (this.entryControl.entryType == '11' && this.entryParamsl.paramValue != '') {
            entryParamsData.push(this.entryParamsl);
        }
        // 风险类型为11-触发控制类,重置连续违规默认给0
        if (this.entryControl.entryType == '11' && ['add', 'copy'].includes(this.itemData.type)) {
            this.entryControl.prohibitionReset = '0';
        }

        let realEntryControl = {};
        if (this.entryControl.unit === '%') {
            let thresholdValueObj = {
                thresholdValue1: this.entryControl.thresholdValue1
                    ? accDiv(this.entryControl.thresholdValue1, 100)
                    : this.entryControl.thresholdValue1,
                thresholdValue2: this.entryControl.thresholdValue2
                    ? accDiv(this.entryControl.thresholdValue2, 100)
                    : this.entryControl.thresholdValue2,
                thresholdValue3: this.entryControl.thresholdValue3
                    ? accDiv(this.entryControl.thresholdValue3, 100)
                    : this.entryControl.thresholdValue3,
                saThresholdValue: this.entryControl.saThresholdValue
                    ? accDiv(this.entryControl.saThresholdValue, 100)
                    : this.entryControl.saThresholdValue,
            };
            realEntryControl = { ...this.entryControl, ...thresholdValueObj };
        } else if (['万元', '万股'].includes(this.entryControl.unit)) {
            let thresholdValueObj = {
                thresholdValue1: this.entryControl.thresholdValue1
                    ? accMul(this.entryControl.thresholdValue1, 10000)
                    : this.entryControl.thresholdValue1,
                thresholdValue2: this.entryControl.thresholdValue2
                    ? accMul(this.entryControl.thresholdValue2, 10000)
                    : this.entryControl.thresholdValue2,
                thresholdValue3: this.entryControl.thresholdValue3
                    ? accMul(this.entryControl.thresholdValue3, 10000)
                    : this.entryControl.thresholdValue3,
                saThresholdValue: this.entryControl.saThresholdValue
                    ? accMul(this.entryControl.saThresholdValue, 10000)
                    : this.entryControl.saThresholdValue,
            };
            realEntryControl = { ...this.entryControl, ...thresholdValueObj };
        } else {
            realEntryControl = this.entryControl;
        }

        let data: any = {
            // entryControl: this.entryControl,
            entryControl: realEntryControl,

            riskEntryControlRelation: this.riskEntryControlRelation,
            riskEntryBranchs: this.riskEntryBranchs,
            entryParams: entryParamsData,
            fundRanges: this.fundRanges,
            riskCustomSetting: this.riskCustomSetting,
        };

        if (this.itemData.type === 'add') {
            this.loading = true;
            this.$axios
                .post(this.urlH + '/insert/entryControl', data)
                .then(res => {
                    this.loading = false;
                    this.yh_message_success('操作成功');
                    this.cancelTable();
                })
                .catch(() => {
                    this.loading = false;
                    this.sbmitdisabled = false;
                });
        } else if (this.itemData.type === 'copy') {
            if (data.entryControl.premise) {
                data.riskEntryControlRelation.joinRiskEntryControls = [];
                data.riskEntryControlRelation.mutualRiskEntryControls = [];
                data.riskEntryControlRelation.premiseRiskEntryControls = [];
            }

            this.loading = true;
            this.$axios
                .post(this.urlH + '/insert/entryControl', data)
                .then(res => {
                    this.loading = false;
                    this.yh_message_success('操作成功');
                    this.cancelTable();
                })
                .catch(() => {
                    this.loading = false;
                    this.sbmitdisabled = false;
                });
        } else {
            if (this.itemData.type === 'edit') {
                this.loading = true;
                this.$axios
                    .post(this.urlH + '/update/entryControl', data)
                    .then(res => {
                        this.loading = false;
                        this.yh_message_success('操作成功');
                        this.cancelTable();
                    })
                    .catch(() => {
                        this.loading = false;
                        this.sbmitdisabled = false;
                    });
            } else if (this.itemData.type === 'editCheck' || this.itemData.type === 'editCheckSetting') {
                if (this.entryControl.unit === '%') {
                    let thresholdValueObj = {
                        thresholdValue1: this.entryControl.thresholdValue1
                            ? accDiv(this.entryControl.thresholdValue1, 100)
                            : this.entryControl.thresholdValue1,
                        thresholdValue2: this.entryControl.thresholdValue2
                            ? accDiv(this.entryControl.thresholdValue2, 100)
                            : this.entryControl.thresholdValue2,
                        thresholdValue3: this.entryControl.thresholdValue3
                            ? accDiv(this.entryControl.thresholdValue3, 100)
                            : this.entryControl.thresholdValue3,
                        saThresholdValue: this.entryControl.saThresholdValue
                            ? accDiv(this.entryControl.saThresholdValue, 100)
                            : this.entryControl.saThresholdValue,
                    };
                    realEntryControl = { ...this.entryControl, ...thresholdValueObj };
                } else if (['万元', '万股'].includes(this.entryControl.unit)) {
                    let thresholdValueObj = {
                        thresholdValue1: this.entryControl.thresholdValue1
                            ? accMul(this.entryControl.thresholdValue1, 10000)
                            : this.entryControl.thresholdValue1,
                        thresholdValue2: this.entryControl.thresholdValue2
                            ? accMul(this.entryControl.thresholdValue2, 10000)
                            : this.entryControl.thresholdValue2,
                        thresholdValue3: this.entryControl.thresholdValue3
                            ? accMul(this.entryControl.thresholdValue3, 10000)
                            : this.entryControl.thresholdValue3,
                        saThresholdValue: this.entryControl.saThresholdValue
                            ? accMul(this.entryControl.saThresholdValue, 10000)
                            : this.entryControl.saThresholdValue,
                    };
                    realEntryControl = { ...this.entryControl, ...thresholdValueObj };
                } else {
                    realEntryControl = this.entryControl;
                }
                // this.postData.entryControl = this.entryControl;
                this.postData.entryControl = realEntryControl;
                this.postData.riskEntryControlRelation = this.riskEntryControlRelation;
                this.postData.riskEntryBranchs = this.riskEntryBranchs;
                this.postData.entryParams = this.entryParams;
                this.postData.fundRanges = this.fundRanges;
                this.loading = true;
                this.$axios
                    .post(this.urlH + '/update/check/entryControl', this.postData)
                    .then(res => {
                        this.loading = false;
                        this.yh_message_success('操作成功');
                        this.cancelTable();
                    })
                    .catch(() => {
                        this.loading = false;
                        this.sbmitdisabled = false;
                    });
            }
            // this.$confirm('确定修改吗？', '提示', {
            //     confirmButtonText: '确定',
            //     cancelButtonText: '取消',
            //     type: 'warning',
            // })
            //     .then(() => {
            //         if (this.itemData.type === 'edit') {
            //             this.loading = true;
            //             this.$axios
            //                 .post('/entry/update/entryControl', data)
            //                 .then(res => {
            //                     this.loading = false;
            //                     this.yh_message_success('操作成功');
            //                     this.cancelTable();
            //                 })
            //                 .catch(() => {
            //                     this.loading = false;
            //                     this.sbmitdisabled = false;
            //                 });
            //         } else if (this.itemData.type === 'editCheck') {
            //             this.postData.entryControl = this.entryControl;
            //             this.postData.riskEntryControlRelation = this.riskEntryControlRelation;
            //             this.postData.riskEntryBranchs = this.riskEntryBranchs;
            //             this.postData.entryParams = this.entryParams;
            //             this.postData.fundRanges = this.fundRanges;
            //             this.loading = true;
            //             this.$axios
            //                 .post('/entry/update/check/entryControl', this.postData)
            //                 .then(res => {
            //                     this.loading = false;
            //                     this.yh_message_success('操作成功');
            //                     this.cancelTable();
            //                 })
            //                 .catch(() => {
            //                     this.loading = false;
            //                     this.sbmitdisabled = false;
            //                 });
            //         }
            //     })
            //     .catch(() => {
            //         this.sbmitdisabled = false;
            //         this.$message({
            //             type: 'info',
            //             message: '已取消删除',
            //         });
            //     });
        }
    }
    // 关闭页面
    cancelTable() {
        this.$emit('opne-table', this.itemData.title, this.itemData.type);
    }

    private changeAccountControlValue(val: any = []): void {
        let all = val.find(item => item === '-1');
        if (val.length === 0) {
            this.Accountdisabled = false;
            this.AccountdisabledAll = false;
        } else if (all === '-1') {
            this.Accountdisabled = false;
            this.AccountdisabledAll = true;
        } else {
            this.Accountdisabled = true;
            this.AccountdisabledAll = false;
        }

        // 拼装tooltip
        let arr = [];
        if (val.some(item => item === '-1')) {
            arr.push({ label: '选择全部' });
        } else {
            val.forEach(item => {
                let obj = this.fundInfo.find(element => item === element['value']);
                if (obj) {
                    arr.push(obj);
                }
            });
        }
        this.tooltipFunds = arr;

        // 下拉框选中数据置顶
        this.fundInfoSelect.data = [{ label: '选择全部', fundCode: '-1' }, ...changeOptions(val, this.fundInfo, 'value')];
    }

    private changeAccountControlValue2(val: any = []): void {
        let all = val.find(item => item === '-1');
        if (val.length === 0) {
            this.Accountdisabled2 = false;
            this.AccountdisabledAll2 = false;
        } else if (all === '-1') {
            this.Accountdisabled2 = false;
            this.AccountdisabledAll2 = true;
        } else {
            this.Accountdisabled2 = true;
            this.AccountdisabledAll2 = false;
        }

        // 拼装tooltip
        let arr = [];
        if (val.some(item => item === '-1')) {
            arr.push({ label: '选择全部' });
        } else {
            val.forEach(item => {
                let obj = this.fundInfo.find(element => item === element['value']);
                if (obj) {
                    arr.push(obj);
                }
            });
        }
        this.tooltipFunds2 = arr;

        // 下拉框选中数据置顶
        this.fundInfoSelect2.data = [{ label: '选择全部', fundCode: '-1' }, ...changeOptions(val, this.fundInfo, 'value')];
    }

    /**
     *
     *
     * 获取数据
     */
    getEntryDetail() {
        if (this.itemData.type === 'add') {
            this.prohOriginalAccoundId = false;
            return;
        } else if (
            this.itemData.type === 'editCheck' ||
            this.itemData.type === 'lookCheck' ||
            this.itemData.type === 'check-look' ||
            this.itemData.type === 'editCheckSetting'
        ) {
            this.loading = true;
            let SerialNo = '';
            let ChangeNo = '';
            if (this.itemData.type === 'editCheckSetting') {
                SerialNo = this.itemData.content.checkSerialNo;
                ChangeNo = this.itemData.content.checkChangeNo;
            } else {
                SerialNo = this.itemData.content.serialNo;
                ChangeNo = this.itemData.content.changeNo;
            }
            this.$axios.get(this.urlH + '/checkDetail/' + this.itemData.content.entryCode + '/' + SerialNo + '/' + ChangeNo).then((res: any) => {
                if (res.entryControl.entryType == '3') {
                    const index5 = res.entryParams.findIndex(item => item.paramType == '5');
                    if (index5 < 0) {
                        res.entryParams.push({ paramType: '5', paramValue: 0, compareType: 0 });
                    }
                    const index6 = res.entryParams.findIndex(item => item.paramType == '6');
                    if (index6 < 0) {
                        res.entryParams.push({ paramType: '6', paramValue: 0, compareType: 0 });
                    }
                    const index8 = res.entryParams.findIndex(item => item.paramType == '8');
                    if (index8 < 0) {
                        res.entryParams.push({ paramType: '8', paramValue: '0', compareType: 0 });
                    }
                } else if (res.entryControl.entryType == '11') {
                    this.originalAccountType = DictionConstUtil.PojoToList(DictionConstUtil.OriginalAccountType);
                    this.entryControl.originalAccountId = '0';
                }
                const index = res.entryParams.findIndex(item => item.paramType == 'K');
                if (index < 0 && !['3', '5', '11'].includes(res.entryControl.entryType)) {
                    res.entryParams.push({ paramType: 'K', paramValue: '0', compareType: 0 });
                }
                res.entryControl.originalAccountId = res.entryControl.originalAccountId.toString();

                this.verifiData = JSON.parse(JSON.stringify(res));
                if (res.entryControl.unit === '%') {
                    if (res.entryControl.thresholdValue1) {
                        res.entryControl.thresholdValue1 = accMul(res.entryControl.thresholdValue1, 100).toString();
                    }
                    if (res.entryControl.thresholdValue2) {
                        res.entryControl.thresholdValue2 = accMul(res.entryControl.thresholdValue2, 100).toString();
                    }
                    if (res.entryControl.thresholdValue3) {
                        res.entryControl.thresholdValue3 = accMul(res.entryControl.thresholdValue3, 100).toString();
                    }
                    if (res.entryControl.saThresholdValue) {
                        res.entryControl.saThresholdValue = accMul(res.entryControl.saThresholdValue, 100).toString();
                    }
                } else if (['万元', '万股'].includes(res.entryControl.unit)) {
                    if (res.entryControl.thresholdValue1) {
                        res.entryControl.thresholdValue1 = accDiv(res.entryControl.thresholdValue1, 10000).toString();
                    }
                    if (res.entryControl.thresholdValue2) {
                        res.entryControl.thresholdValue2 = accDiv(res.entryControl.thresholdValue2, 10000).toString();
                    }
                    if (res.entryControl.thresholdValue3) {
                        res.entryControl.thresholdValue3 = accDiv(res.entryControl.thresholdValue3, 10000).toString();
                    }
                    if (res.entryControl.saThresholdValue) {
                        res.entryControl.saThresholdValue = accDiv(res.entryControl.saThresholdValue, 10000).toString();
                    }
                }
                if (res.entryControl.beginDate == 0) {
                    res.entryControl.beginDate = '';
                } else {
                    res.entryControl.beginDate = res.entryControl.beginDate.toString();
                }
                if (res.entryControl.endDate == 0) {
                    res.entryControl.endDate = '';
                } else {
                    res.entryControl.endDate = res.entryControl.endDate.toString();
                }
                if (res.entryControl.sourceType === '2') {
                    res.entryControl.saThresholdType = '3';
                }
                this.entryControl = res.entryControl;

                this.changPremise(this.entryControl.premise);

                // 风险等级
                this.compareDirection = DictionConstUtil.PojoToList(DictionConstUtil.CompareDirection).filter(item =>
                    ['5', '3'].includes(this.entryControl.entryType) ? item.dictKey === '6' : !['4', '5', '6'].includes(item.dictKey)
                );

                setTimeout(() => {
                    this.prohOriginalAccoundId = false;
                }, 500);

                // this.broadcast('BranchSetting', 'setentryTypes', this.entryControl.entryType);

                this.riskEntryControlRelation = res.riskEntryControlRelation;
                this.premiseRelations = res.entryControl.premiseRelation;
                if (res.entryControl.controlValue) {
                    if (res.entryControl.controlValue == '0') {
                        this.entryControl.controlValue = '';
                    } else {
                        this.entryControl.controlValue = res.entryControl.controlValue.toString();
                        this.handleBaseInfo(this.entryControl.controlValue);
                    }
                }
                if (res.entryControl.dateType) {
                    if (res.entryControl.dateType == '0') {
                        this.entryControl.dateType = '';
                    } else {
                        this.entryControl.dateType = res.entryControl.dateType.toString();
                    }
                }
                this.riskEntryBranchList = res.riskEntryBranchs;
                this.riskEntryBranchs = res.riskEntryBranchs;
                this.entryParamsList = res.entryParams;
                let ParamsList = JSON.parse(JSON.stringify(this.entryParamsList));
                for (let i = 0; i < ParamsList.length; i++) {
                    if (ParamsList[i].paramType === 'l') {
                        this.entryParamsl.paramValue = ParamsList[i].paramValue;
                    }
                }
                this.fundRangesList = res.fundRanges;
                this.riskCustomSettings = res.riskCustomSetting;
                this.postData.changeNo = res.changeNo;
                this.postData.historyNo = res.historyNo;
                this.postData.modifyType = res.modifyType;
                this.postData.serialNo = res.serialNo;
                this.changeAccountControlValue(this.entryControl.accountControlValue);
                this.changeAccountControlValue2(this.entryControl.accountDebarValue);
                this.loading = false;
            });
        } else if (
            this.itemData.type === 'look' ||
            this.itemData.type === 'edit' ||
            this.itemData.type === 'copy' ||
            this.itemData.type == 'history-look'
        ) {
            this.loading = true;
            const url =
                this.itemData.type == 'history-look'
                    ? this.urlH + '/history/detail/' + this.itemData.content + '/' + this.itemData.historyNo
                    : this.urlH + '/detail/' + this.itemData.content;
            this.$axios.get(url).then((res: any) => {
                if (res.entryControl.entryType == '3') {
                    const index5 = res.entryParams.findIndex(item => item.paramType == '5');
                    if (index5 < 0) {
                        res.entryParams.push({ paramType: '5', paramValue: 0, compareType: 0 });
                    }
                    const index6 = res.entryParams.findIndex(item => item.paramType == '6');
                    if (index6 < 0) {
                        res.entryParams.push({ paramType: '6', paramValue: 0, compareType: 0 });
                    }
                    const index8 = res.entryParams.findIndex(item => item.paramType == '8');
                    if (index8 < 0) {
                        res.entryParams.push({ paramType: '8', paramValue: '0', compareType: 0 });
                    }
                } else if (res.entryControl.entryType == '11') {
                    this.originalAccountType = DictionConstUtil.PojoToList(DictionConstUtil.OriginalAccountType);
                    this.entryControl.originalAccountId = '0';
                }
                const index = res.entryParams.findIndex(item => item.paramType == 'K');
                if (index < 0 && !['3', '5', '11'].includes(res.entryControl.entryType)) {
                    res.entryParams.push({ paramType: 'K', paramValue: '0', compareType: 0 });
                }
                this.verifiData = JSON.parse(JSON.stringify(res));
                if (res.entryControl.unit === '%') {
                    if (res.entryControl.thresholdValue1) {
                        res.entryControl.thresholdValue1 = accMul(res.entryControl.thresholdValue1, 100).toString();
                    }

                    if (res.entryControl.thresholdValue2) {
                        res.entryControl.thresholdValue2 = accMul(res.entryControl.thresholdValue2, 100).toString();
                    }
                    if (res.entryControl.thresholdValue3) {
                        res.entryControl.thresholdValue3 = accMul(res.entryControl.thresholdValue3, 100).toString();
                    }
                    if (res.entryControl.saThresholdValue) {
                        res.entryControl.saThresholdValue = accMul(res.entryControl.saThresholdValue, 100).toString();
                    }
                } else if (['万元', '万股'].includes(res.entryControl.unit)) {
                    if (res.entryControl.thresholdValue1) {
                        res.entryControl.thresholdValue1 = accDiv(res.entryControl.thresholdValue1, 10000).toString();
                    }
                    if (res.entryControl.thresholdValue2) {
                        res.entryControl.thresholdValue2 = accDiv(res.entryControl.thresholdValue2, 10000).toString();
                    }
                    if (res.entryControl.thresholdValue3) {
                        res.entryControl.thresholdValue3 = accDiv(res.entryControl.thresholdValue3, 10000).toString();
                    }
                    if (res.entryControl.saThresholdValue) {
                        res.entryControl.saThresholdValue = accDiv(res.entryControl.saThresholdValue, 10000).toString();
                    }
                }
                if (res.entryControl.beginDate == 0) {
                    res.entryControl.beginDate = '';
                } else {
                    res.entryControl.beginDate = res.entryControl.beginDate.toString();
                }
                if (res.entryControl.endDate == 0) {
                    res.entryControl.endDate = '';
                } else {
                    res.entryControl.endDate = res.entryControl.endDate.toString();
                }
                res.entryControl.originalAccountId = res.entryControl.originalAccountId.toString();
                if (res.entryControl.sourceType === '2') {
                    res.entryControl.saThresholdType = '3';
                }
                this.entryControl = res.entryControl;

                this.changPremise(this.entryControl.premise);

                // 风险等级
                this.compareDirection = DictionConstUtil.PojoToList(DictionConstUtil.CompareDirection).filter(item =>
                    ['5', '3'].includes(this.entryControl.entryType) ? item.dictKey === '6' : !['4', '5', '6'].includes(item.dictKey)
                );
                setTimeout(() => {
                    this.prohOriginalAccoundId = false;
                }, 500);

                this.premiseRelations = res.entryControl.premiseRelation;
                this.changeAccountControlValue(this.entryControl.accountControlValue);
                this.changeAccountControlValue2(this.entryControl.accountDebarValue);

                // this.broadcast('BranchSetting', 'setentryTypes', this.entryControl.entryType);

                if (res.entryControl.controlValue) {
                    if (res.entryControl.controlValue == '0') {
                        this.entryControl.controlValue = '';
                    } else {
                        this.entryControl.controlValue = res.entryControl.controlValue.toString();
                        this.handleBaseInfo(this.entryControl.controlValue);
                    }
                }
                if (res.entryControl.dateType) {
                    if (res.entryControl.dateType == '0') {
                        this.entryControl.dateType = '';
                    } else {
                        this.entryControl.dateType = res.entryControl.dateType.toString();
                    }
                }
                this.riskEntryControlRelation = res.riskEntryControlRelation;
                this.riskEntryBranchList = res.riskEntryBranchs;
                this.riskEntryBranchs = res.riskEntryBranchs;
                this.riskCustomSettings = res.riskCustomSetting;

                this.entryParamsList = res.entryParams;
                let ParamsList = JSON.parse(JSON.stringify(this.entryParamsList));
                for (let i = 0; i < ParamsList.length; i++) {
                    if (ParamsList[i].paramType === 'l') {
                        this.entryParamsl.paramValue = ParamsList[i].paramValue;
                    }
                }
                this.fundRangesList = res.fundRanges;
                this.loading = false;
            });
        }
    }
    // "复核通过按钮"
    async submitVerification2(submitType) {
        this.selectedArrList = [];
        let selectedArrList = [
            {
                changeNo: this.verifiData.entryControl.changeNo,
                serialNo: this.verifiData.entryControl.serialNo,
                entryCode: this.verifiData.entryControl.entryCode,
            },
        ];
        this.selectedArrList = selectedArrList;
        if (this.verifiData.entryControl.modifyType == '1') {
            this.verification = true;
            if (submitType == '2') {
                this.verificationTitle = '确认复核通过以下条目吗';
            } else if (submitType == '1') {
                this.verificationTitle = '确认复核拒绝以下条目吗';
            }
        } else {
            this.$axios.post(this.urlH + '/checkAllow/compare', selectedArrList).then((res: any) => {
                this.editDatas = res[0];
                this.verification = true;
                if (submitType == '2') {
                    this.verificationTitle = '确认复核通过以下条目吗';
                } else if (submitType == '1') {
                    this.verificationTitle = '确认复核拒绝以下条目吗';
                }
            });
        }
    }

    // 复核请求
    reCheckReset(type: string, val: any): void {
        let url = '';

        if (type === '1') {
            url = this.urlH + '/check/allow';
        } else {
            url = this.urlH + '/check/refuse';
        }
        this.$axios
            .post(url, [val])
            .then((res: any) => {
                this.yh_message_success('复核成功');
                this.verification = false;
                this.cancelTable();
            })
            .catch(() => {
                this.verification = false;
            });
    }

    /**
     * 作用范围勾选变动事件
     */
    handleRiskCalTypes(val: string[]): void {
        if (this.entryControl.entryType === '3') {
            if (val.includes('0')) {
                const controlModel = this.entryParams.find(i => i.paramType === '7')?.paramValue;
                if (controlModel && controlModel !== '1') {
                    this.yh_message_warn('同向反向静态 不支持除有买有卖模式以外的模式!');
                    this.entryControl.riskCalTypes = this.entryControl.riskCalTypes.filter(i => i !== '0');
                }
            }
        }
    }

    /**
     * 华泰崩溃预警
     */
    getMemory(): void {
        const memory = (performance as any).memory;
        const usedMemory = memory.usedJSHeapSize / 1024 / 1024; // 转换为MB
        const totalMemory = memory.totalJSHeapSize / 1024 / 1024; // 转换为MB
        const memoryLimit = memory.jsHeapSizeLimit / 1024 / 1024; // 转换为MB

        console.log('已使用内存：' + usedMemory + 'MB');
        console.log('总内存：' + totalMemory + 'MB');
        console.log('内存限制：' + memoryLimit + 'MB');

        // if (usedMemory > 1900) {
        //     removeUser();
        //     router.push({ path: '/login' });
        // }
    }
}
</script>
<style lang="scss" scoped>
.cont-detail {
    color: #222;
    width: 100%;
    height: 100%;
    overflow: auto;

    #detail {
        height: 100%;
        .form {
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        .content-3 {
            height: calc(100vh - 370px);
            min-height: 320px;
        }
        .row-style {
            margin-bottom: 10px;
            // min-width: 1200px;
            // overflow: auto;

            & /deep/ .el-card__body {
                padding: 5px;
            }

            & /deep/ .el-form-item--mini.el-form-item,
            .el-form-item--small.el-form-item {
                margin-bottom: 5px;
            }

            .card-box .card-left {
                margin-right: 5px;
            }

            .card-right {
                position: relative;
            }

            .card-box .card-right {
                margin-right: 5px;
            }

            .card-right .right-inputs {
                width: 140px;
            }

            .card-right .select-style {
                position: absolute;
                width: 40px;
                left: 146px;
                top: 0;
                // display: inline-block;
            }

            .select-style /deep/ .el-input__icon {
                display: none;
            }

            .select-style /deep/ .el-input--suffix .el-input__inner {
                padding: 0 10px;
            }

            .buts {
                display: inline;
                float: right;
                padding: 5px;
            }

            .detail-col {
                padding: 10px;
                .col-row {
                    padding-top: 10px;
                }
            }
        }
    }
    & /deep/ .el-button--mini,
    .el-button--mini.is-round {
        padding: 6px 10px;
    }

    & /deep/ .el-select__tags {
        flex-wrap: nowrap;
        overflow: hidden;
        position: absolute;
        left: 2%;
    }
}
/deep/ .el-form-item--mini .el-form-item__label {
    color: #222;
}
/deep/ .el-select__tags-text {
    display: inline-block;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/deep/ .el-tag__close.el-icon-close {
    top: -5px;
}

// 树形下拉选择样式
/deep/ .vue-treeselect {
    height: 26px !important;
    .vue-treeselect__control {
        height: 28px !important;
    }
}
/deep/ .vue-treeselect__multi-value-item,
/deep/.vue-treeselect__limit-tip-text {
    background-color: #f4f4f5 !important;
    border-color: #e9e9eb !important;
    color: #909399 !important;
    line-height: 15px;
}
/deep/ .vue-treeselect__value-remove {
    color: #909399 !important;
}
/deep/ .vue-treeselect__multi-value {
    height: 20px;
    margin-bottom: 3px;
    .vue-treeselect__multi-value-item-container,
    .vue-treeselect__limit-tip {
        padding-top: 0px !important;
        padding-right: 0px !important;
    }
    .vue-treeselect__input-container {
        padding-top: 0px !important;
        .vue-treeselect__input {
            height: 24px;
            line-height: 24px;
        }
    }
    .vue-treeselect__placeholder {
        height: 28px;
        line-height: 28px;
    }
}
/deep/.el-input.is-disabled .el-input__inner {
    background-color: transparent;
}
</style>
<style lang="scss">
.vue-treeselect--open-below .vue-treeselect__menu {
    top: 1px !important;
}
</style>
